Enable WordPress 3.x Menu in Old Themes

WordPress 3.x added support for multiple site management through single installation & custom menu option to manage the Menu of your site. This feature is pretty cool but can’t be used with old themes. I love my librio WordPress theme & didn’t wanted to compromise on that. So eventually I ended up hacking couple of files to enable this feature.

I’m not a PHP expert, but certainly got Custom Menu feature working on this blog itself.

If you try to customize Menu & displays the following message

The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.

it means your theme doesn’t support new feature from 3.0.

Simple follow these steps:

  • Edit the Theme functions (functions.php) and add the following entry

    add_action( 'init', 'register_menus' );

    function register_menus() {
    // This theme uses wp_nav_menu() in one location.
    // Adds support for Menu feature in WordPress 3
    register_nav_menus( array(
    'primary' => __( 'Primary Navigation', 'Librio' ),
    ) );
    }

  • Edit the Header (Header.php) and add this

    <\?php wp_nav_menu( array('container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>

    Note: Take out the escaping before question mark.

  • You are done 🙂

Leave a comment

Your comment

*