Before you can start this tutorial, you’ll need to follow the tutorial on how to add the WordPress 3 menu to Thesis.
Once you finish that tutorial, you will have the following in your custom_functions.php:
add_action('init','register_menu');
remove_action('thesis_hook_before_header','thesis_nav_menu');
add_action('thesis_hook_before_header','wordpress_menu_support');
function register_menu() {
register_nav_menus(
array(
'primary'=>'Primary Menu'
));
}
function wordpress_menu_support() {
if (function_exists('wp_nav_menu'))
wp_nav_menu('theme_location=primary&fallback_cb=thesis_nav_menu');
else
thesis_nav_menu();
}
Now we need to do two things:
- Register the menu area.
- Hook the menu area into place. In this example I’ll be putting a menu above the footer.
To accomplish this, we will add the following to our code from above:
add_action('init','register_menu');
remove_action('thesis_hook_before_header','thesis_nav_menu');
add_action('thesis_hook_before_header','wordpress_menu_support');
add_action('thesis_hook_before_footer','footer_menu');
function register_menu() {
register_nav_menus(
array(
'primary'=>'Primary Menu',
'footer'=>'Footer Menu'
));
}
function footer_menu() {
wp_nav_menu('theme_location=footer');
}
function wordpress_menu_support() {
if (function_exists('wp_nav_menu'))
wp_nav_menu('theme_location=primary&fallback_cb=thesis_nav_menu');
else
thesis_nav_menu();
}
For the register part, I simply added a comma then 'footer'=>'Footer Menu'. The first part, 'footer' is the menu slug. The second part, 'Footer Menu' is what will be displayed in the WordPress admin. So, if you were going to add a menu above the content, you may do something like this 'content-menu'=>'Content Menu'.
The second thing I did was add a function that contains my menu.
function footer_menu() {
wp_nav_menu('theme_location=footer');
}If I wanted to add the menu above the content, I would do something like this:
function content_menu() {
wp_nav_menu('theme_location=content-menu');
}
Lastly, I hooked my function into place with
add_action('thesis_hook_before_footer','footer_menu');If I were putting a menu area above the content, I may do something like this:
add_action('thesis_hook_before_content','content_menu');
{ 7 comments… read them below or add one }
Donation submitted as a thank you for the custom code request! I may be back later with questions, but wanted to say thanks!
Thank you!
Thanks again to you Matt!
I want to add a menu in top of page…can you help me ?
Hi,
Thank you so much for this tutorial. I tried to follow to the letter, bu no matter what I try, I end up with an error.
What I try to accomplish is to add a category menu just after div#header.
-> Page Menu
-> Title / tagline / Image
-> Category Menu
-> Content
The error I get is:
“Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘pixie_menu’ was given in /home/MY_DOMAIN/public_html/wp-includes/plugin.php on line 395″
Please help
Great tutorial!!!
Say I wanted to add a menu inside another function/action.
Im creating a full width nav bar using thesis_hook_before_html
I tried to just echo the custom menu function, but it didnt work.
any ideas on how to add a custom menu inside there?
hi
you are very good with menus i was wondering if you chould help
i installed wishlist on my thesis site http://www.karmasecrets.com
it makes the whole menu dissapears in IE, Chrome and Safary but it works in Firefax
if you could help with quick solution i will be grateful
thanks
Robert