123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <?php
- include 'inc/function.php';
- // use Twig\Environment;
- // use Twig\Extensions\IntlExtension;
- //
- // $twig = new Environment($loader);
- // $twig->addExtension(new IntlExtension());
- // CUSTOM FUNCTION
- // include custom jQuery
- function includejquery() {
- wp_deregister_script('jquery');
- wp_enqueue_script( 'jquery',
- get_template_directory_uri() . '/asset/dist/js/jquery-3.5.1.min.js',
- array() );
- }
- add_action('wp_enqueue_scripts', 'includejquery');
- function includedrag() {
- wp_deregister_script('drag-ui');
- wp_enqueue_script( 'drag-ui',
- get_template_directory_uri() . '/asset/dist/js/jquery-ui.js',
- array() );
- }
- add_action('wp_enqueue_scripts', 'includedrag');
- function theme_js(){
- wp_enqueue_script( 'rellax',
- get_template_directory_uri() . '/asset/dist/js/rellax.pkgd.min.js',
- array() );
- wp_enqueue_script( 'flickity',
- get_template_directory_uri() . '/asset/dist/js/flickity.pkgd.min.js',
- array() );
- wp_enqueue_script( 'flickity-fade',
- get_template_directory_uri() . '/asset/dist/js/flickity-fade.js',
- array() );
- wp_enqueue_script( 'masonry',
- get_template_directory_uri() . '/asset/dist/js/masonry.pkgd.min.js',
- array() );
- wp_enqueue_script( 'isotope',
- get_template_directory_uri() . '/asset/dist/js/isotope.pkgd.min.js',
- array() );
- wp_enqueue_script( 'script',
- get_template_directory_uri() . '/asset/dist/index.js',
- array() );
- }
- add_action( 'wp_footer', 'theme_js' );
- // ADD OPTION PAGES
- if( function_exists('acf_add_options_page') ) {
- acf_add_options_page(array(
- 'page_title' => 'Information',
- 'menu_title' => 'Information',
- 'menu_slug' => 'information',
- 'capability' => 'edit_posts',
- 'redirect' => false
- ));
- acf_add_options_sub_page(array(
- 'page_title' => 'Partenaires',
- 'menu_title' => 'Partenaires',
- 'parent_slug' => 'information',
- ));
- }
- add_filter( 'timber_context', 'options_footer' );
- function options_footer( $context ) {
- $context['options'] = get_fields('option');
- return $context;
- }
- function post_temps_forts() {
- $labels = array(
- 'name' => _x('Les temps forts', 'Post Type General Name', 'la_mine'),
- 'singular_name' => _x('Temps fort', 'Post Type Singular Name', 'la_mine'),
- 'menu_name' => __('Les temps forts', 'la_mine'),
- 'name_admin_bar' => __('Les temps forts', 'la_mine'),
- 'parent_item_colon' => __('Parent Item:', 'la_mine'),
- 'all_items' => __('All temps forts', 'la_mine'),
- 'add_new_item' => __('Add New temps forts', 'la_mine'),
- 'add_new' => __('Add temps fort', 'la_mine'),
- 'new_item' => __('New temps fort', 'la_mine' ),
- 'edit_item' => __('Edit temps fort', 'la_mine'),
- 'update_item' => __('Update temps fort', 'la_mine'),
- 'view_item' => __('View temps fort', 'la_mine'),
- 'search_items' => __('Search temps fort', 'la_mine'),
- 'not_found' => __('Not found', 'la_mine'),
- 'not_found_in_trash' => __('Not found in Trash', 'la_mine'),
- );
- $rewrite = array(
- 'slug' => _x('les-temps-forts', 'les-temps-forts', 'la_mine'),
- 'with_front' => true,
- 'pages' => true,
- 'feeds' => false,
- );
- $args = array(
- 'label' => __('les-temps-forts', 'la_mine'),
- 'description' => __('Les temps forts', 'la_mine'),
- 'labels' => $labels,
- 'supports' => array('title', 'thumbnail', 'custom-fields'),
- 'taxonomies' => array('temps_forts_type'),
- 'hierarchical' => false,
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'menu_position' => 5,
- 'menu_icon' => 'dashicons-megaphone',
- 'show_in_admin_bar' => true,
- 'show_in_nav_menus' => true,
- 'can_export' => true,
- 'has_archive' => false,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'query_var' => 'temps_forts',
- 'rewrite' => $rewrite,
- 'capability_type' => 'page',
- );
- register_post_type('les-temps-forts', $args);
- }
- add_action('init', 'post_temps_forts', 10);
- function post_projets() {
- $labels = array(
- 'name' => _x('Les projets', 'Post Type General Name', 'la_mine'),
- 'singular_name' => _x('Projet', 'Post Type Singular Name', 'la_mine'),
- 'menu_name' => __('Les projets', 'la_mine'),
- 'name_admin_bar' => __('Les projets', 'la_mine'),
- 'parent_item_colon' => __('Parent Item:', 'la_mine'),
- 'all_items' => __('All projets', 'la_mine'),
- 'add_new_item' => __('Add New projet', 'la_mine'),
- 'add_new' => __('Add projet', 'la_mine'),
- 'new_item' => __('New projet', 'la_mine' ),
- 'edit_item' => __('Edit projet', 'la_mine'),
- 'update_item' => __('Update projet', 'la_mine'),
- 'view_item' => __('View projet', 'la_mine'),
- 'search_items' => __('Search projet', 'la_mine'),
- 'not_found' => __('Not found', 'la_mine'),
- 'not_found_in_trash' => __('Not found in Trash', 'la_mine'),
- );
- $rewrite = array(
- 'slug' => _x('les-projets', 'les-projets', 'la_mine'),
- 'with_front' => true,
- 'pages' => true,
- 'feeds' => false,
- );
- $args = array(
- 'label' => __('les-projets', 'la_mine'),
- 'description' => __('Les projets', 'la_mine'),
- 'labels' => $labels,
- 'supports' => array('title', 'thumbnail', 'custom-fields'),
- 'taxonomies' => array('les_projets_type'),
- 'hierarchical' => false,
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'menu_position' => 6,
- 'menu_icon' => 'dashicons-hammer',
- 'show_in_admin_bar' => true,
- 'show_in_nav_menus' => true,
- 'can_export' => true,
- 'has_archive' => false,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'query_var' => 'les_projets',
- 'rewrite' => $rewrite,
- 'capability_type' => 'page',
- );
- register_post_type('les-projets', $args);
- }
- add_action('init', 'post_projets', 10);
- add_action( 'init', 'cp_change_post_object' );
- // Change dashboard Posts to News
- function cp_change_post_object() {
- $get_post_type = get_post_type_object('post');
- $labels = $get_post_type->labels;
- $labels->name = 'Évenements';
- $labels->singular_name = 'Évenements';
- $labels->add_new = 'Add Évenements';
- $labels->add_new_item = 'Add Évenements';
- $labels->edit_item = 'Edit Évenements';
- $labels->new_item = 'Évenements';
- $labels->view_item = 'View Évenements';
- $labels->search_items = 'Search Évenements';
- $labels->not_found = 'No Évenements found';
- $labels->not_found_in_trash = 'No Évenements found in Trash';
- $labels->all_items = 'All Évenements';
- $labels->menu_name = 'Évenements';
- $labels->name_admin_bar = 'Évenements';
- }
- ?>
|