Shopping Cart (0)

Customizing your WordPress Admin area

1 Posted March 27, 2012 by Rockstar Frog Categories: Code Snippets

When developing WordPress sites for clients, it is likely that you’ll want to customize the admin area to make it easier for your client to navigate and use. Today’s article is going to cover a few techniques to optimize, simplify and improve the WordPress admin area for your clients.

Menu Items

There’s a lot of admin menu items that, once your site is setup and complete, you don’t need access to anymore. So here’s a simple function to strip out unwanted WordPress admin menu items.

function remove_add_menu_pages() {
    remove_menu_page('edit.php');
    remove_menu_page('upload.php');
    remove_menu_page('link-manager.php');
    remove_menu_page('edit.php?post_type=page');
    remove_menu_page('edit-comments.php');
    remove_menu_page('themes.php');
    remove_menu_page('plugins.php');
    remove_menu_page('users.php');
    remove_menu_page('tools.php');
    remove_menu_page('options-general.php');
    remove_menu_page('update-core.php');
    remove_submenu_page('edit.php?post_type=post-application', 'post-new.php?post_type=post-application');
}

add_action('admin_menu', 'remove_add_menu_pages' );

That changes this:

to this:

The remove_menu_page() function does the obvious, and accepts 1 parameter – the PHP file name of the page you want to exclude from the menu. The remove_submenu_page() function however, accepts and requires 2 parameters – the parent menu item and the sub menu item that you want to exclude.

Custom Admin Columns

Many blogs utilize featured images in their layout. However in the admin, there’s no built-in method of viewing the featured image for each post. However grabbing onto a WordPress hook, we can inject a new column into the default WordPress post view:

function new_admin_columns($defaults) {  
    $defaults['featured_image'] = 'Feat Img';  
    return $defaults;  
}  
 
function new_admin_columns_content($column_name, $post_ID) {  
    if ($column_name == 'featured_image') {  
        $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), full );  
        if ($thumbnail) {  
            echo '';  
        }  
    }  
}

add_filter('manage_posts_columns', 'new_admin_columns');  
add_action('manage_posts_custom_column', 'new_admin_columns_content', 10, 2);

The above code gives you this:

In the first function new_admin_columns(), we create the new column entitled “Feat Img”. The second function new_admin_columns_content() lets us specify what is displayed in that new content. In this case, we set the $thumbnail variable to be the featured image for the post, and then we display this thumbnail if one has been specified.

Customize your admin login logo

If you’re customizing a WordPress site for your client, it’d be a nice touch to add their logo to the login page. In other words, to change this:

to this:

Here’s how you do it:

function custom_login_logo() {
    echo '';
}

add_action('login_head', 'custom_login_logo');

Custom Footer Texts

Finally, WordPress was kind enough to give us a hook to customize the default text visible in the bottom left of the admin. By default, the text will read: “Thank you for creating with WordPress”. It’s quick and easy to change this however:

function custom_footer_text() {
  echo 'eFrogThemes.com loves WordPress.';
}
add_filter('admin_footer_text', 'custom_footer_text');

Do you use any of these tweaks? Do you have any you can share with us?

Comments

28/03/2012 12:28 am
Guru Frog

Really useful article Rockstar Frog, what an excellent way to purchase an eFrog Theme and use it for a client and protect the client from accessing areas that might cause problems!

Reply

Leave a Comment

TimThumb not displaying images? Let’s fix that!

If you've noticed that a number of images aren't displaying correctly ... Read more

George has something new to show you

Hello tadpoles! We're as happy and excited as a dog with two tails, to tell you about the latest theme from the team around the pond. It's called Cohesion, and we like to think of it as "a socially-engaged business theme". Read more

Adding a Tweet Box to your site

Both Windows and Mac are integrating social media platforms more and m... Read more

Valentines Giveaway: Win a copy of our new gorgeous theme – Occasions

Love is in the air, and lucky for you frogs aren't immune to Cupid's m... Read more

Hello, lovely tadpoles! Do you remember our post about adding Twit...

eFrog News Categories

Browse our themes