Can I rename my labels on the admin menus?

I know I can change the labels (http://bit.ly/1qGqGW5). However, if I do that, will my theme's "Recent Posts" shortcode still work?

Problem: I created a CPT with CustomPress. The shortcode plugin I used to display the CPT (display-posts-shortcode) interferes with my company's firewall (Can't use content editor with PU activated). I have been researching creating my own shortcode to display "Recent CPT", but I seem to be complicating things .

Can I change "Posts" and "Add Post" to "Jobs" and "Add Job" without changing how how they are queried for the shortcode--just cosmetically?

All I need to create is basically this (only with custom field meta data displayed under each posting) http://hro.minationalguard.com/postings/. It's a simple list, so don't really even need a new CPT--just need to add some custom fields. I sincerely hope my question made sense.

  • Ash

    Hello @Josh

    If you want it for one site in your network, you need to know the ID of that site. If you go to the Network Admin > Dashboard > Sites > All Sites and edit that site you will get the ID in the url.

    Then use the code like this:

    if( get_current_blog_id() == 4 ){
    //add that code in here
    }

    Here I assume 4 is the ID for that site.

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Cheers
    Ash

  • Josh

    Yup...I screwed that up...The header on all my site(network-wide) displayed my code, while the menus mockingly remained unchanged. The site id is 15.

    The good news is that is is looking at my mu-plugins folder, right? Here is my code:

    // Replace Posts label as Articles in Admin Panel
    if( get_current_blog_id() == 15 ){
    
    function change_post_menu_label() {
        global $menu;
        global $submenu;
        $menu[5][0] = 'Jobs';
        $submenu['edit.php'][5][0] = 'Jobs';
        $submenu['edit.php'][10][0] = 'Post Job';
        echo '';
    }
    function change_post_object_label() {
            global $wp_post_types;
            $labels = &$wp_post_types['post']->labels;
            $labels->name = 'Jobs';
            $labels->singular_name = 'Job';
            $labels->add_new = 'Post Job';
            $labels->add_new_item = 'Post Job';
            $labels->edit_item = 'Edit Job';
            $labels->new_item = 'Job';
            $labels->view_item = 'View Job';
            $labels->search_items = 'Search Jobs';
            $labels->not_found = 'No Jobs found';
            $labels->not_found_in_trash = 'No Jobs found in Trash';
    }
    add_action( 'init', 'change_post_object_label' );
    add_action( 'admin_menu', 'change_post_menu_label' );
    
    }
  • Josh

    In case others are looking for the same thing...This code changed the admin menu and admin bar labeling on just one of my network sites. I created a mu-plugins folder in wp-content and created a document called "change_menu.php". I then pasted the following code. Worked like a charm. (Changed sit ID to represent whatever site in your network you wish to change).

    <?php // Replace Posts label as Articles in Admin Panel
    if( get_current_blog_id() == 15 ){
    
    function change_post_menu_label() {
        global $menu;
        global $submenu;
        $menu[5][0] = 'Jobs';
        $submenu['edit.php'][5][0] = 'Jobs';
        $submenu['edit.php'][10][0] = 'Post Job';
        echo '';
    }
    function change_post_object_label() {
            global $wp_post_types;
            $labels = &$wp_post_types['post']->labels;
            $labels->name = 'Jobs';
            $labels->singular_name = 'Job';
            $labels->add_new = 'Post Job';
            $labels->add_new_item = 'Post Job';
            $labels->edit_item = 'Edit Job';
            $labels->new_item = 'Job';
            $labels->view_item = 'View Job';
            $labels->search_items = 'Search Jobs';
            $labels->not_found = 'No Jobs found';
            $labels->not_found_in_trash = 'No Jobs found in Trash';
            $labels->name_admin_bar = 'Jobs';
    }
    add_action( 'init', 'change_post_object_label' );
    add_action( 'admin_menu', 'change_post_menu_label' );
    
    function change_post_admin_bar_label() {
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function($) {
                $('#wp-admin-bar-new-post > a').text('Job');
            });
        </script>
        <?php
    }
    add_action( 'wp_after_admin_bar_render', 'change_post_admin_bar_label' );
    
    } ?>

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.