Outils pour utilisateurs

Outils du site


Panneau latéral

webdev:wordpress:backoffice

Améliorer le backoffice

functions.php :

// -----------------------------------------------------------------------------
//                        Amélioration du backoffice
// Enlever les menus inutiles
function remove_menus(){
 
  //remove_menu_page( 'index.php' );                  //Dashboard
  //remove_menu_page( 'edit.php' );                   //Posts
  //remove_menu_page( 'upload.php' );                 //Media
  //remove_menu_page( 'edit.php?post_type=page' );    //Pages
  //remove_menu_page( 'edit-comments.php' );          //Comments
  //remove_menu_page( 'themes.php' );                 //Appearance
  //remove_menu_page( 'plugins.php' );                //Plugins
  //remove_menu_page( 'users.php' );                  //Users
  //remove_menu_page( 'tools.php' );                  //Tools
  //remove_menu_page( 'options-general.php' );        //Settings
 
}
add_action( 'admin_menu', 'remove_menus' );

// Ajouter le style des pages pour le backoffice
add_editor_style("editor-style.css");

// Ajouter les styles personnalisés à TinyMCE
// Callback function to insert 'styleselect' into the $buttons array
function my_mce_buttons_2( $buttons ) {
    array_unshift( $buttons, 'styleselect' );
    return $buttons;
}
// Register our callback to the appropriate filter
add_filter('mce_buttons_2', 'my_mce_buttons_2');

// Callback function to filter the MCE settings
function my_mce_before_init_insert_formats( $init_array ) {  
    // Define the style_formats array
    $style_formats = array(  
        // Each array child is a format with it's own settings
        array(  
            'title' => 'Texte d\'accueil',   
                        'block' => 'p',
            'classes' => 'texte-accueil',
            'wrapper' => false,
        ),  
    );  
    // Insert the array, JSON ENCODED, into 'style_formats'
    $init_array['style_formats'] = json_encode( $style_formats );  
    
    return $init_array;  
 
}
// Attach callback to 'tiny_mce_before_init'
add_filter( 'tiny_mce_before_init', 'my_mce_before_init_insert_formats' );

http://codex.wordpress.org/Function_Reference/remove_menu_page

webdev/wordpress/backoffice.txt · Dernière modification: 16/01/2016 21:23 (modification externe)