http://themethesis.com/wp-content/uploads/2010/06/thesis-wordpress-3-nav-menu.jpg

How to Add the WordPress 3 Nav Menu to Thesis

June 14, 2010

in Tutorials

Wordpress 3 Nav Menu in Thesis

WordPress 3 has a sweet new menu. Thesis already had a sweet menu. Still, some people would like to take advantage of all that this new release of WordPress offers and using the new navigation menu is one of them. Luckily it’s incredibly easy to add support for the new nav menu in Thesis.


Open custom_functions.php and add:

function wp3_nav() { ?>

	<?php
	add_theme_support( 'nav-menus' );
	wp_nav_menu();
	?>

<?php }
add_action('thesis_hook_before_header', 'wp3_nav');
remove_action('thesis_hook_before_header', 'thesis_nav_menu');

That adds support for the new menu and removes the original Thesis nav. You can style the new nav the same way that you styled the old one, as that seems works out of the box. You can have both running at the same time if you omit the last line. You can also change the hook for our new function wp3_nav and place it anywhere you’d like.

I only preliminarily tested this to make sure it worked and could be styled, so you might find bugs. Note that WordPress 3 isn’t even in final release yet.

More information:
wp_nav_menu at the Codex.

Thesis Theme for WordPress:  Options Galore and a Helpful Support Community

You'll notice this site talks about the Thesis theme for Wordpress. Don't know what the heck that is? Find out.

{ 11 comments… read them below or add one }

Mark June 14, 2010 at 7:16 pm

I following your instructions and the menu did not change out. I was surprised that it didn’t even remove the old menu and make a mess. Nothing happened.

Reply

Matt Dunn June 14, 2010 at 7:36 pm

You might have something conflicted in another function, which could be something else referencing the nav bar or something not closed properly etc. It’s hard to tell without more detail.

But at the very least,

remove_action(’thesis_hook_before_header’, ‘thesis_nav_menu’);

will remove the nav bar. If it doesn’t, there’s something going on with another function somewhere.

Reply

Joachim Kudish June 14, 2010 at 7:51 pm

Little errata up there, it should be custom_functions.php and not functions.php!

Reply

Matt Dunn June 14, 2010 at 7:57 pm

Ah good catch! Thanks.

Reply

Hesham June 15, 2010 at 5:27 am

I wonder when it’s time to move to WP 3.0, then I will be back for this ;) Thanks Matt!

Reply

Nora June 18, 2010 at 11:24 pm

Hi there – thanks for this tutorial. How would I center the menu in use at the top on http://www.lakotawestbands.org?

All the best,

Nora

Reply

Prospirity August 2, 2010 at 11:13 pm

Chris has now addressed this issue in Thesis 1.8 beta1. You can choose to use WP or Thesis menu. We simply select the one we choose to use

Reply

fareed August 22, 2010 at 6:35 pm

Very very thankful to you Friend, helpful tutorial for me…..Thanks

Reply

David Radovanovic September 12, 2010 at 11:20 pm

Works great in FireFox but IE8 produces lots of errors. I prefer wp3.0 menu since all customizations are within the wp3 custom menu interface.

Reply

Matt Dunn September 19, 2010 at 2:27 pm

Note: This tutorial isn’t super useful anymore, since Thesis 1.8 comes with support for WordPress 3 already.

Reply

Blogusion December 18, 2010 at 5:03 pm

Thank you for this code…

Reply

Leave a Comment

{ 1 trackback }

Previous post:

Next post: