functions.php 5.5 KB

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