Not everything here is about finances or real estate.  My former life was a very technical life, and those skills and the drive to tinker haven’t ended.  As you can see by my various websites, I am a WordPress junkie, and my primary theme is Thesis, by DIYTHEMES.

Today I answered one of my own questions on the forum with a little research and ingenuity.

The question was how do I register a 2nd menu for Thesis and then implement it.

WordPress 3.0 implemented a new menu system which makes building your menus much easier, in my opinion.  Some other programmers out there may not agree, but for the novice php tinker-junkie like myself, it’s perfect.

Thesis Version:  1.8b3

WordPress Version: 3.0

Cost to implement:  $0.00. (there’s the financial section)

In order to make this happen with Thesis, it’s important that you have the Thesis options set to use the WordPress menu system instead of the Thesis menu system.  Once that’s set, you can get to the meat of the matter.

If you don’t know how to utilize hooks in Thesis, stop.  You need to understand this process first.  Thesishooks.com is a good place to start to learn how to do this.

Register an Additional Menu for your Thesis Theme

By default, there is only provision for one menu in Thesis when you use the WordPress menu system.  You need to make sure your theme can handle two menus.  Open yourcustom_functions.php file and insert the following code:

<?php
add_action( ‘init’, ‘register_my_menu’ );
function register_my_menu() {
register_nav_menu( ‘sub-menu’, __( ‘Sub Menu’ ) );
}
?>
Make sure that the parameters you set for register_nav_menu match the name of the menu you create in WordPress (sub-menu is the slug, and Sub Menu is the name of the menu.)
Next, write the function and add the hook to display your menu in the custom_functions.php file:
<? function sub_menu() { ?>
<?php wp_nav_menu( array( ‘theme_location’ => ‘sub-menu’ ) ); ?>
<? } ?>
<? add_action(‘thesis_hook_before_header’,'sub_menu’); ?>
That’s it.  Everything you place in the Sub Menu in the WordPress Menu configuration will show up wherever you place this function.  My example places the secondary sub-menu above the header on my site.





Related posts

coded by nessus
Tagged with:
 

Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>