Tag Archives: Functions File

How to Change the Admin Menu Names in WordPress

The following will change, “Posts” to “Blog Posts” in the WordPress backend. I find this useful when creating sites for Clients. Sometimes the out-of-the-box naming convention for WordPress needs a little tweaking for the non power user. Simply add this function to your theme’s function.php file.

function change_post_menu_label() {
    global $menu;
    global $submenu;
    $menu[5][0] = 'Blog Posts';
    $submenu['edit.php'][5][0] = 'Blog Posts';
    $submenu['edit.php'][10][0] = 'Add a Blog Post';
    echo '';
}
add_action( 'admin_menu', 'change_post_menu_label' );

How to Change the Names of Menu items in the WordPress Backend

What are “Posts”? Sounds like a silly question for an everyday WordPress user. But for the client that may not be accustom to everyday WordPress lingo it gets downright confusing. So, let’s change the names! Simple enough. Let’s add some functions to your theme’s function.php file.

This function changes the “Menu Name”. So in this example, we are changing, “Posts” to “Blog Entries”.

// Changing WordPress admin Menu Names
function change_post_menu_label() {
    global $menu;
    global $submenu;
    $menu[5][0] = 'Blog Entries';
    $submenu['edit.php'][5][0] = 'Blog Entries';
    $submenu['edit.php'][10][0] = 'Add a Blog Entry';
    echo '';
}
add_action( 'admin_menu', 'change_post_menu_label' );

You can even change the name, “Categories” and “Tags” to fit your specific project:

// Changing WordPress admin Menu Names
function change_post_menu_label() {
    global $menu;
    global $submenu;
    $menu[5][0] = 'Blog Entries';
    $submenu['edit.php'][5][0] = 'Blog Entries';
    $submenu['edit.php'][10][0] = 'Add a Blog Entry';
    $submenu['edit.php'][15][0] = 'Status'; // Change name for categories
    $submenu['edit.php'][16][0] = 'Labels'; // Change name for tags
    echo '';
}
add_action( 'admin_menu', 'change_post_menu_label' );

You can also change the way the post object is edited and it’s names.

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

How to remove Menu Items that Clients don’t need.

WordPress is great. It has so much functionality that it can get overwhelming especially for clients. Clean up the backend with a couple of simple functions added to the functions.php file in your theme folder. I’ve gone ahead and added a couple, but you can edit the array to your hearts desire.

// Remove unwanted menu Items 
function remove_menus () {
global $menu;
	$restricted = array(
	__('Dashboard'), 
	__('Tools'),
	__('Comments'));
	end ($menu);
	while (prev($menu)){
		$value = explode(' ',$menu[key($menu)][0]);
		if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
	}
}
add_action('admin_menu', 'remove_menus');

How to add a Custom Login Logo for Clients

Add the following to your theme’s functions.php file. Also remember to add your login logo (png) into your theme’s “images” folder.

function custom_login_logo() {
        echo '';
}
add_action('login_head', 'custom_login_logo'); 

function my_login_logo_url() {
    return get_bloginfo( 'url' );
}
add_filter( 'login_headerurl', 'my_login_logo_url' );

function my_login_logo_url_title() {
    return get_bloginfo('name');
}
add_filter( 'login_headertitle', 'my_login_logo_url_title' );