How to Use a WordPress 3.0 Menu in Thesis
Thesis is a powerful theme framework for WordPress that allows you to develop a completely custom structure and look by using the Thesis building tools. By default, Thesis has its own menu builder, which was helpful when WordPress could only create navigation from a list of pages or posts by category. With the release of WordPress 3.0 and higher, a built-in menu builder is now available, which makes the Thesis menu options redundant. Since the WordPress 3.0 menu is easier to use and more dynamic, you may want to replace the Thesis menu. This can be accomplished by adding a few lines of code into the Thesis template file.
Instructions
-
-
1
Open the "custom_functions.php" file in a text editor or HTML editor. Alternatively, you can click on "Appearance" followed by "Editor" from within your WordPress administration panel. Click the "custom_functions.php" link from the right side.
-
2
Place your cursor in the blank line just after "<?php" at the top of the document. Highlight and copy the following lines of code:
add_theme_support('menus');
register_nav_menu('primary', 'Primary Navigation');
remove_action('thesis_hook_before_header', 'thesis_nav_menu');
add_action('thesis_hook_before_header', 'new_menu');
function new_menu() {
wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) );
}
Paste your code into the blank line after the "<?php" line. The new code tells WordPress that your theme supports the 3.0 Menu system, creates a new menu called "Primary Navigation" and replaces the "Thesis" menu with this new menu.
-
-
3
Click the "Update File" button if you are editing within WordPress, or save the file and upload it to your live Thesis location.
-
4
Click on "Appearance" followed by "Menus" from within the WordPress Administration panel. Select the "Primary Navigation" menu from the drop-down menu, and proceed to edit the menu as you desire. Click "Save Menu" when you are finished.
-
1
Tips & Warnings
Download the "custom_functions.php" file and edit it locally. Rename the live version before uploading your edited copy in case something goes wrong. You can rename the original back to "custom_functions.php" to revert changes.
References
Resources
- Photo Credit Stockbyte/Stockbyte/Getty Images