Remove the WordPress admin top bar

If you are as annoyed as me when it comes to the WordPress admin top bar, you can remove this for your user by going to Users > Your Profile under the Show Admin Bar and disable the option you want, in dashboard or while viewing the site.

If you want to completely remove the bar for all users you can enter one of the following codes in the functions.php file:

//REMOVE ADMIN BAR
remove_action('init', 'wp_admin_bar_init');
// Disable the Admin Bar
add_filter( 'show_admin_bar', '__return_false' );

Now the admin top bar should disappear for all users on both cases, when viewing the site from backend and frontend

WordPress 3.3.1 Update

I found out that on wordpress 3.3.1 (and maybe some versions bellow) the codes from above are not working. If you have WordPress 3.3.1 the correct code is:

//REMOVE ADMIN BAR
remove_action('init', '_wp_admin_bar_init');

 

Enable WordPress 3.0 custom menu in your theme

wordpress-custom-menu

With the release of WordPress 3 the users can now activate the new custom menu feature which let’s you easily customize menus. Custom Navigation Menus feature in WordPress 3.0 will make WordPress even more user friendly for beginners. This function let you organize your menu, create drop down menus, add new items to menu, and much more. The drag-and-drop function of this feature is what makes it extremely easy to use. This feature will not be available in older themes unless the theme author(s) update their themes. In this article, we will show you how you can enable and install custom navigation menus in your themes.

Check if the theme has custom menus enabled

To see if your theme has the new custom menus feature enabled, while in the Admin area, go to Appearence > Menus. If your current theme doesn’t support custom menus you’ll see this error message:

custom-menu-error

Enable the custom menu feature for your theme

Now, to enable the feature for your theme go to functions.php file and enter the following code:

<?php
if ( function_exists( 'register_nav_menu' ) ) {
    add_action( 'init', 'register_my_menu' );
    function register_my_menu() {
	register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );
    }
}
?>

The above code does the following:

  • Check to see if the register_nav_menu function exists
  • If the function exists, after WordPress has finished loading but before any headers are sent, call the register_my_menu function
  • Register a new menu with the name of Primary Menu

Display the new menu in your theme

To display the newly created menu enter the following code in the header.php file or where ever you want to display the menu

<?php
$args = array('theme_location' => 'primary-menu');
wp_nav_menu($args);
?>

Now your theme has the new custom menu feature enabled. To add/remove/modify the menu you can now login to WP-ADMIN and go to Appearence > Menus

Customizing the menu structure using the wp_nav_menu arguments

If you want your menu to have a custom structure/class/id you can use the wp_nav_menu parameters. Bellow is a list with the parameters and their default values that the function accepts:

<?php
$args = array(
  'theme_location'  => ,
  'menu'            => ,
  'container'       => 'div',
  'container_class' => 'menu-{menu slug}-container',
  'container_id'    => ,
  'menu_class'      => 'menu',
  'menu_id'         => ,
  'echo'            => true,
  'fallback_cb'     => 'wp_page_menu',
  'before'          => ,
  'after'           => ,
  'link_before'     => ,
  'link_after'      => ,
  'items_wrap'      => '
    %3$s
', 'depth' => 0, 'walker' => ); ?>

For a detailed list about each parameter check the WordPress Codex Page

 

HTML5 and CSS3 Most Creative Features

beta.theexpressiveweb.com

HTML5 and CSS3 brings loads of new features and functionality to the modern web.

The Expressive Web site is a resource and showcase of some of the newest, and most expressive features being added to the web today.

Read more

 

The site is up

GzG Home Page

After quite some time, the site is finally up. You will find here some of my designs as well as resources and tutorials related to graphic/web design and HTML/CSS/JavaScript coding. I’ll try to keep the blog as updated as my time allows it so stay tuned.

Next on the list is a mobile theme for the site. The design is already finished, so only the coding and testing part remains.

 

Blog Categories

Popular Posts