Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have spent the last day using the functions.php file to fully customize WordPress for my client sites. I am amazed at how much I have been able to accomplish and how much easier it will make things for my clients.

I have removed certain menu items for users that are not logged in as an admin. What I am hoping (and from what I have read know it can be done) is to find a way to rename some of the menu items (left sidebar in the admin area). For instance change Posts to Articles.

If anyone can supply the code for the functions.php file or point me in the direction I would greatly appreciate it!

share|improve this question
    
Maybe you should split this up into two different questions: "Renaming admin menu items" and "Changing the order of admin menu items"? This will help you get more views for your question. –  Jan Fabry Feb 13 '11 at 15:39
    
Thanks, I just did that. I am new here and still learning my way around the site. –  Adam Feb 13 '11 at 16:11

3 Answers 3

up vote 34 down vote accepted

Here's the process to change the labels (I changed posts to "contacts" in my example)

function change_post_menu_label() {
    global $menu;
    global $submenu;
    $menu[5][0] = 'Contacts';
    $submenu['edit.php'][5][0] = 'Contacts';
    $submenu['edit.php'][10][0] = 'Add Contacts';
    $submenu['edit.php'][15][0] = 'Status'; // Change name for categories
    $submenu['edit.php'][16][0] = 'Labels'; // Change name for tags
    echo '';
}

function change_post_object_label() {
        global $wp_post_types;
        $labels = &$wp_post_types['post']->labels;
        $labels->name = 'Contacts';
        $labels->singular_name = 'Contact';
        $labels->add_new = 'Add Contact';
        $labels->add_new_item = 'Add Contact';
        $labels->edit_item = 'Edit Contacts';
        $labels->new_item = 'Contact';
        $labels->view_item = 'View Contact';
        $labels->search_items = 'Search Contacts';
        $labels->not_found = 'No Contacts found';
        $labels->not_found_in_trash = 'No Contacts found in Trash';
    }
    add_action( 'init', 'change_post_object_label' );
    add_action( 'admin_menu', 'change_post_menu_label' );

To change the menu order, go with this:

// CUSTOMIZE ADMIN MENU ORDER
   function custom_menu_order($menu_ord) {
       if (!$menu_ord) return true;
       return array(
        'index.php', // this represents the dashboard link
        'edit.php', //the posts tab
        'upload.php', // the media manager
        'edit.php?post_type=page', //the posts tab
    );
   }
   add_filter('custom_menu_order', 'custom_menu_order');
   add_filter('menu_order', 'custom_menu_order');

I've got code to remove items, but it's globally and not based on user access level

share|improve this answer
    
This is excellent thanks! Now I just need to find a way of moving a sub menu item (ex. Menus) as a main menu button. Any idea on that? –  Adam Feb 13 '11 at 0:18
    
Haven't tested, but see if adding 'nav-menus.php' to the array moves it up. –  Norcross Feb 13 '11 at 0:29
    
Unfortunately no. This has been the one part that has been bugging me. I just want to be able to have the menus and widgets be their own buttons so it is easier for clients. Thank you though for trying –  Adam Feb 13 '11 at 0:33

I agree....the functions.php file gives lots of flexibility. I've needed some of the same functionality that you described with a combination of functions.php filters and this template:

http://wordpress.org/extend/plugins/admin-menu-editor/

From what I can tell..this plugin would accomplish both of your issues and it works well in Multi-Site install situations too. Hope that helps.

share|improve this answer
    
Ooops...shoot, sorry, just saw the bit about not wanting to use a plugin. There are definitely ways to go about translating the tab names and placements with just the Functions.php. For me, after heading down this path (trying to be plugin-free for this) I decided that the extra coding just wasn't worth it...given how easy that plugin was to use. Sorry I missed that criteria before. –  Ross Feb 12 '11 at 20:11
    
No problem Ross, I am going to look into it anyway. Thanks –  Adam Feb 13 '11 at 0:34

You might want to look at this question

and the class they mention there on gist

which holds functions that you ara looking for

rename_admin_menu_section()

to rename for instance change Posts to Articles

and you can remove the appearances menu and create you new top page menu item for

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.