Hi all,
I'm posting this for those of you who might be looking on how to implement the new navigation menus that come with Wordpress 3.0
The technique Chris posted on Thematic4you didn't seem to be working with the final WP 3.0 version so I went ahead looking for solutions:
http://programming.thematic4you.com/2010/03/how-to-test-wp_nav_menu-with-thematic/
With the help of the WP Codex and a great post by Justin Tadlock (links bellow) I got the new menu to work with Thematic:
http://codex.wordpress.org/Function_Reference/wp_nav_menu
http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus
I'm not very good with PHP so if any of you have any suggestions to improve the code they are welcome!
// We declare that our theme supports wp_nav_menu()
add_theme_support( 'nav-menus' );
// We Register the a new menu for the theme called "Primary Menu"
function register_primary_menu() {
register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );
}
add_action( 'init', 'register_primary_menu' );
// We remove the standard Thematic menu
function remove_menu() {
remove_action('thematic_header','thematic_access',9);
}
add_action('init', 'remove_menu');
// We create the new wp_nav_menu called "Primary Menu" in our theme
function new_access() { ?>
<div id="access">
<div class="skip-link"><a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>"><?php _e('Skip to content', 'thematic'); ?></a></div><!-- .skip-link -->
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array(
'theme_location' => 'primary-menu', // we define this as being the previously registered "Primary Menu"
'menu_class' => 'sf-menu', // we assign the sf-menu class to the menu ul so that superfish workds
'container_class' => 'menu' // we assign the menu class to the menu container div so to keep it compatible with the Thematic menu styling
));
?>
</div><!-- #access -->
<?php
}
add_action('thematic_header','new_access',9);