bugfix: - is_admin() ne marche que dans back-end - current_user_can(‘administrator’) marche partout
107 lines
3.3 KiB
PHP
107 lines
3.3 KiB
PHP
<?php
|
||
load_theme_textdomain( 'yuzu-child', get_template_directory() . '-child/languages' );
|
||
|
||
/* enqueue scripts and style from parent theme */
|
||
function yuzu_styles() {
|
||
//wp_enqueue_style( 'parent', get_template_directory_uri() . '/style.css' );
|
||
|
||
$parent_style = 'parent'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
|
||
|
||
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
|
||
wp_enqueue_style( 'child-style',
|
||
get_stylesheet_directory_uri() . '/style.css',
|
||
array( $parent_style ),
|
||
wp_get_theme()->get('Version')
|
||
);
|
||
|
||
}
|
||
add_action( 'wp_enqueue_scripts', 'yuzu_styles');
|
||
|
||
// Modifier le seuil à 3200px:
|
||
add_filter( 'big_image_size_threshold', 'modify_big_image_size_threshold', 10, 4 );
|
||
function modify_big_image_size_threshold( $threshold, $imagesize, $file, $attachment_id ) {
|
||
return 4096;
|
||
}
|
||
|
||
// Désactiver complètement le seuil maximum:
|
||
//add_filter( 'big_image_size_threshold', '__return_false' );
|
||
|
||
// Infos sur les tailles d’images actives:
|
||
//add_action( 'admin_init', 'theme_additional_images' );
|
||
function theme_additional_images() {
|
||
global $_wp_additional_image_sizes;
|
||
echo '<pre>' . print_r($_wp_additional_image_sizes) . '</pre>';
|
||
}
|
||
|
||
|
||
// Add Toolbar Menus
|
||
function custom_toolbar() {
|
||
global $wp_admin_bar;
|
||
|
||
$args = array(
|
||
'id' => 'parent-menu',
|
||
'title' => __( 'My Menu', 'yuzu-child' ),
|
||
);
|
||
$wp_admin_bar->add_menu( $args );
|
||
|
||
$args = array(
|
||
'id' => 'child1-menu',
|
||
'parent' => 'parent-menu',
|
||
'title' => __( 'clicclac.info', 'yuzu-child' ),
|
||
'href' => 'https://clicclac.info',
|
||
);
|
||
$wp_admin_bar->add_menu( $args );
|
||
|
||
$args = array(
|
||
'id' => 'child2-menu',
|
||
'parent' => 'parent-menu',
|
||
'title' => __( 'Extensions', 'yuzu-child' ),
|
||
'href' => 'https://' . '$_SERVER["HTTP_HOST"]' . '/wordpress/wp-admin/plugins.php',
|
||
);
|
||
$wp_admin_bar->add_menu( $args );
|
||
|
||
$args = array(
|
||
'id' => 'child3-menu',
|
||
'parent' => 'parent-menu',
|
||
'title' => __( 'Articles', 'yuzu-child' ),
|
||
'href' => 'https://' . '$_SERVER["HTTP_HOST"]' . '/wordpress/wp-admin/edit.php',
|
||
);
|
||
$wp_admin_bar->add_menu( $args );
|
||
|
||
$args = array(
|
||
'id' => 'child4-menu',
|
||
'parent' => 'parent-menu',
|
||
'title' => __( 'Medias', 'yuzu-child' ),
|
||
'href' => 'https://' . '$_SERVER["HTTP_HOST"]' . '/wordpress/wp-admin/upload.php?rml_folder',
|
||
);
|
||
$wp_admin_bar->add_menu( $args );
|
||
|
||
$args = array(
|
||
'id' => 'child5-menu',
|
||
'parent' => 'parent-menu',
|
||
'title' => __( 'Pages', 'yuzu-child' ),
|
||
'href' => 'https://' . '$_SERVER["HTTP_HOST"]' . '/wordpress/wp-admin/edit.php?post_type=page',
|
||
);
|
||
$wp_admin_bar->add_menu( $args );
|
||
|
||
$args = array(
|
||
'id' => 'child6-menu',
|
||
'parent' => 'parent-menu',
|
||
'title' => __( 'Réglages', 'yuzu-child' ),
|
||
'href' => 'https://' . '$_SERVER["HTTP_HOST"]' . '/wordpress/wp-admin/options-general.php',
|
||
);
|
||
$wp_admin_bar->add_menu( $args );
|
||
|
||
$args = array(
|
||
'id' => 'child6-menu',
|
||
'parent' => 'parent-menu',
|
||
'title' => __( 'WP/LR Sync (Galleries)', 'yuzu-child' ),
|
||
'href' => 'https://' . '$_SERVER["HTTP_HOST"]' . '/wordpress/wp-admin/admin.php?page=wplr-collections-tags-menu',
|
||
);
|
||
$wp_admin_bar->add_menu( $args );
|
||
|
||
}
|
||
if ( current_user_can( 'administrator' ) ) {
|
||
add_action( 'wp_before_admin_bar_render', 'custom_toolbar', 999 );
|
||
}
|
||
?>
|