Files
lamine_wp/web/app/themes/la_mine/functions.php
T
2020-09-22 19:25:08 +02:00

208 lines
7.2 KiB
PHP

<?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() . '/src/assets/js/jquery-3.5.1.min.js',array() );
}
add_action('wp_footer', 'includejquery');
function flickity(){
wp_enqueue_script( 'flick',
get_template_directory_uri() . '/src/assets/js/flickity.pkgd.min.js', array() );
}
add_action( 'wp_footer', 'flickity' );
function isotope(){
wp_enqueue_script( 'isotope',
get_template_directory_uri() . '/src/assets/js/isotope.pkgd.min.js', array() );
}
add_action( 'wp_footer', 'isotope' );
function imgLoad(){
wp_enqueue_script( 'imagesloaded.pkgd.min.js',
get_template_directory_uri() . '/src/assets/js/imagesloaded.pkgd.min.js', array() );
}
add_action( 'wp_footer', 'imgLoad' );
function rellax(){
wp_enqueue_script( 'rellax',
get_template_directory_uri() . '/src/assets/js/rellax.pkgd.min.js', array() );
}
add_action( 'wp_footer', 'rellax' );
function customJs(){
wp_enqueue_script( 'script',
get_template_directory_uri() . '/src/assets/js/scripts.js', array() );
}
add_action( 'wp_footer', 'customJs' );
// 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');
// 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';
}
?>