functions.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?php
  2. include 'inc/function.php';
  3. // use Twig\Environment;
  4. // use Twig\Extensions\IntlExtension;
  5. //
  6. // $twig = new Environment($loader);
  7. // $twig->addExtension(new IntlExtension());
  8. // CUSTOM FUNCTION
  9. function theme_js(){
  10. wp_enqueue_script( 'bootstrap',
  11. get_template_directory_uri() . '/asset/dist/js/bootstrap.js',
  12. array() );
  13. wp_enqueue_script( 'flickity',
  14. get_template_directory_uri() . '/asset/dist/js/flickity.pkgd.min.js',
  15. array() );
  16. wp_enqueue_script( 'masonry',
  17. get_template_directory_uri() . '/asset/dist/js/masonry.pkgd.min.js',
  18. array() );
  19. wp_enqueue_script( 'isotope',
  20. get_template_directory_uri() . '/asset/dist/js/isotope.pkgd.min.js',
  21. array() );
  22. wp_enqueue_script( 'script',
  23. get_template_directory_uri() . '/asset/dist/index.js',
  24. array() );
  25. }
  26. add_action( 'wp_footer', 'theme_js' );
  27. // ADD OPTION PAGES
  28. if( function_exists('acf_add_options_page') ) {
  29. acf_add_options_page(array(
  30. 'page_title' => 'Information',
  31. 'menu_title' => 'Information',
  32. 'menu_slug' => 'information',
  33. 'capability' => 'edit_posts',
  34. 'redirect' => false
  35. ));
  36. acf_add_options_sub_page(array(
  37. 'page_title' => 'Partenaires',
  38. 'menu_title' => 'Partenaires',
  39. 'parent_slug' => 'information',
  40. ));
  41. }
  42. add_filter( 'timber_context', 'options_footer' );
  43. function options_footer( $context ) {
  44. $context['options'] = get_fields('option');
  45. return $context;
  46. }
  47. function post_temps_forts() {
  48. $labels = array(
  49. 'name' => _x('Les temps forts', 'Post Type General Name', 'la_mine'),
  50. 'singular_name' => _x('Temps fort', 'Post Type Singular Name', 'la_mine'),
  51. 'menu_name' => __('Les temps forts', 'la_mine'),
  52. 'name_admin_bar' => __('Les temps forts', 'la_mine'),
  53. 'parent_item_colon' => __('Parent Item:', 'la_mine'),
  54. 'all_items' => __('All temps forts', 'la_mine'),
  55. 'add_new_item' => __('Add New temps forts', 'la_mine'),
  56. 'add_new' => __('Add temps fort', 'la_mine'),
  57. 'new_item' => __('New temps fort', 'la_mine' ),
  58. 'edit_item' => __('Edit temps fort', 'la_mine'),
  59. 'update_item' => __('Update temps fort', 'la_mine'),
  60. 'view_item' => __('View temps fort', 'la_mine'),
  61. 'search_items' => __('Search temps fort', 'la_mine'),
  62. 'not_found' => __('Not found', 'la_mine'),
  63. 'not_found_in_trash' => __('Not found in Trash', 'la_mine'),
  64. );
  65. $rewrite = array(
  66. 'slug' => _x('les-temps-forts', 'les-temps-forts', 'la_mine'),
  67. 'with_front' => true,
  68. 'pages' => true,
  69. 'feeds' => false,
  70. );
  71. $args = array(
  72. 'label' => __('les-temps-forts', 'la_mine'),
  73. 'description' => __('Les temps forts', 'la_mine'),
  74. 'labels' => $labels,
  75. 'supports' => array('title', 'thumbnail', 'custom-fields'),
  76. 'taxonomies' => array('temps_forts_type'),
  77. 'hierarchical' => false,
  78. 'public' => true,
  79. 'show_ui' => true,
  80. 'show_in_menu' => true,
  81. 'menu_position' => 5,
  82. 'menu_icon' => 'dashicons-megaphone',
  83. 'show_in_admin_bar' => true,
  84. 'show_in_nav_menus' => true,
  85. 'can_export' => true,
  86. 'has_archive' => false,
  87. 'exclude_from_search' => false,
  88. 'publicly_queryable' => true,
  89. 'query_var' => 'temps_forts',
  90. 'rewrite' => $rewrite,
  91. 'capability_type' => 'page',
  92. );
  93. register_post_type('les-temps-forts', $args);
  94. }
  95. add_action('init', 'post_temps_forts', 10);
  96. function post_projets() {
  97. $labels = array(
  98. 'name' => _x('Les projets', 'Post Type General Name', 'la_mine'),
  99. 'singular_name' => _x('Projet', 'Post Type Singular Name', 'la_mine'),
  100. 'menu_name' => __('Les projets', 'la_mine'),
  101. 'name_admin_bar' => __('Les projets', 'la_mine'),
  102. 'parent_item_colon' => __('Parent Item:', 'la_mine'),
  103. 'all_items' => __('All projets', 'la_mine'),
  104. 'add_new_item' => __('Add New projet', 'la_mine'),
  105. 'add_new' => __('Add projet', 'la_mine'),
  106. 'new_item' => __('New projet', 'la_mine' ),
  107. 'edit_item' => __('Edit projet', 'la_mine'),
  108. 'update_item' => __('Update projet', 'la_mine'),
  109. 'view_item' => __('View projet', 'la_mine'),
  110. 'search_items' => __('Search projet', 'la_mine'),
  111. 'not_found' => __('Not found', 'la_mine'),
  112. 'not_found_in_trash' => __('Not found in Trash', 'la_mine'),
  113. );
  114. $rewrite = array(
  115. 'slug' => _x('les-projets', 'les-projets', 'la_mine'),
  116. 'with_front' => true,
  117. 'pages' => true,
  118. 'feeds' => false,
  119. );
  120. $args = array(
  121. 'label' => __('les-projets', 'la_mine'),
  122. 'description' => __('Les projets', 'la_mine'),
  123. 'labels' => $labels,
  124. 'supports' => array('title', 'thumbnail', 'custom-fields'),
  125. 'taxonomies' => array('les_projets_type'),
  126. 'hierarchical' => false,
  127. 'public' => true,
  128. 'show_ui' => true,
  129. 'show_in_menu' => true,
  130. 'menu_position' => 6,
  131. 'menu_icon' => 'dashicons-hammer',
  132. 'show_in_admin_bar' => true,
  133. 'show_in_nav_menus' => true,
  134. 'can_export' => true,
  135. 'has_archive' => false,
  136. 'exclude_from_search' => false,
  137. 'publicly_queryable' => true,
  138. 'query_var' => 'les_projets',
  139. 'rewrite' => $rewrite,
  140. 'capability_type' => 'page',
  141. );
  142. register_post_type('les-projets', $args);
  143. }
  144. add_action('init', 'post_projets', 10);
  145. ?>