functions.php 5.7 KB

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