/*------------------------------------------------------------*\ Gestion des options de l'admin \*------------------------------------------------------------*/ if( function_exists('acf_add_options_page') ) { acf_add_options_page(array( 'page_title' => 'Paramètres', 'menu_title' => 'Paramètres', 'menu_slug' => 'parametres', 'capability' => 'edit_posts', 'redirect' => false )); } /*------------------------------------------------------------*\ Gestion des scripts et css \*------------------------------------------------------------*/ function theme_scripts() { $theme_path = get_template_directory(); $css_ver = file_exists($theme_path . '/style.css') ? filemtime($theme_path . '/style.css') : null; $js_ver = file_exists($theme_path . '/js/scripts.js') ? filemtime($theme_path . '/js/scripts.js') : null; wp_enqueue_style('style-name', get_stylesheet_uri(), [], $css_ver); // wp_enqueue_style('googleFonts', get_bloginfo('template_url').'http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css'); wp_enqueue_style('font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css'); wp_enqueue_script('JSglobal', get_template_directory_uri() . '/js/scripts.js', [], $js_ver, true); $suggest_path = $theme_path . '/js/search-suggestions.js'; wp_enqueue_script('search-suggestions', get_template_directory_uri() . '/js/search-suggestions.js', [], file_exists($suggest_path) ? filemtime($suggest_path) : null, true); } add_action( 'wp_enqueue_scripts', 'theme_scripts' ); add_action( 'wp_enqueue_style', 'enqueue_our_required_stylesheets'); /*------------------------------------------------------------*\ Intégration des icones wp \*------------------------------------------------------------*/ //add_action( 'wp_enqueue_scripts', 'themename_scripts' ); function themename_scripts() { wp_enqueue_style( 'themename-style', get_stylesheet_uri(), array( 'dashicons' ), '1.0' ); } /*------------------------------------------------------------*\ Ajout du slug de la page dans la class de
\*------------------------------------------------------------*/ function add_slug_body_class( $classes ) { global $post; if ( isset( $post ) ) { $classes[] = $post->post_type . '-' . $post->post_name; } return $classes; } add_filter( 'body_class', 'add_slug_body_class' ); function df_disable_comments_post_types_support() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(post_type_supports($post_type, 'comments')) { remove_post_type_support($post_type, 'comments'); remove_post_type_support($post_type, 'trackbacks'); } } } add_action('admin_init', 'df_disable_comments_post_types_support'); // Close comments on the front-end function df_disable_comments_status() { return false; } add_filter('comments_open', 'df_disable_comments_status', 20, 2); add_filter('pings_open', 'df_disable_comments_status', 20, 2); // Hide existing comments function df_disable_comments_hide_existing_comments($comments) { $comments = array(); return $comments; } add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2); // Remove comments page in menu function df_disable_comments_admin_menu() { remove_menu_page('edit-comments.php'); } add_action('admin_menu', 'df_disable_comments_admin_menu'); // Redirect any user trying to access comments page function df_disable_comments_admin_menu_redirect() { global $pagenow; if ($pagenow === 'edit-comments.php') { wp_redirect(admin_url()); exit; } } add_action('admin_init', 'df_disable_comments_admin_menu_redirect'); // Remove comments metabox from dashboard function df_disable_comments_dashboard() { remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); } add_action('admin_init', 'df_disable_comments_dashboard'); // Remove comments links from admin bar function df_disable_comments_admin_bar() { if (is_admin_bar_showing()) { remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60); } } add_action('init', 'df_disable_comments_admin_bar'); add_action('admin_head', 'cleanDashboard'); function cleanDashboard() { ?> }