functions.php 5.9 KB

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