Justin S. Lewis

WordPress Theme Developer

Removing the new WordPress admin bar without a plugin

March 4th, 2011 · Functions, Tutorials · → No Comments

One of the awesome new features of WordPress 3.1 is the inclusion of an admin bar like the one seen on WordPress.com blogs. WordPress 3.1 allows the individual user to choose whether or not they want to see the admin bar by editing the settings in their user profile. Checking off the boxes there will hide it.

As great as this new feature is, suppose you don’t want anyone to see an admin bar on your site. Maybe it conflicts with your site design or you just don’t like the functionality. Removing the admin bar is easy, just add the following to your theme functions.php:

/ Disable the Admin Bar. /

add_filter( 'show_admin_bar', '__return_false' );

/ Remove the Admin Bar preference in user profile /

remove_action( 'personal_options', '_admin_bar_preferences' );

If you want to hide it from everyone except the admins you can use this instead:

/ Disable the Admin Bar for all but admins. /

if(!current_user_can('administrator')):

show_admin_bar(false);

endif;

/ Remove the Admin Bar preference in user profile /

remove_action( 'personal_options', '_admin_bar_preferences' );

Note: This is for self-hosted blogs running WordPress 3.1 only.

→ No CommentsTags:··

One theme, two stylesheets: A WordPress Tutorial

November 15th, 2009 · CSS, Tutorials · → 4 Comments

Suppose you want your WordPress installation to have one layout and CSS styling for some pages be completely different from the layout and styling for other pages. For example, you might like to have a members only section have a completely different style than the public side of your site. Some WordPress users suggest using multiple installations of WordPress. Another way to do it would be to have two different headers and two different css files used in conjunction with page templates. Another advantage to this technique is there is no need to edit any of the HTML or add any additional CSS classes or IDs. [Read more →]

→ 4 CommentsTags: