Files
lamine_wp/web/app/themes/la_mine/functions.php
T
2020-06-28 17:51:56 +02:00

185 lines
5.9 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() . '/asset/dist/js/jquery-3.5.1.min.js',
array() );
}
add_action('wp_enqueue_scripts', 'includejquery');
function theme_js(){
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);
?>