functions.php 6.0 KB

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