ThemeShaper Forums » Thematic


WordPress 3.0 and the upcoming Thematic release

(4 posts)
  • Started 11 years ago by Chris
  • Latest reply from carlos007h
  • This topic is not a support question
  1. Hi,

    currently Gene and I are testing the upcoming Thematic release against WordPress 3.0.

    If you can't wait please read this post first:

    If you still can't wait, you can grab the latest SVN copy from:

    Or download something that is considered a stable development release running on all of my blogs:

    Thematic won't use wp_nav_menu() out of the box, because I don't want to break any child theme.

    If you created only one wp_nav_menu or the one that you're going to use as the primary menu is the first one you created, just add the following code to your child theme's functions.php:

    function change_menu_type() {
    	return 'wp_nav_menu';
    add_filter( 'thematic_menu_type', 'change_menu_type' );

    If you have more than one menu or you want to use the second or third one in the list, you need to add some additional code to your child theme's functions.php:

    function switch_menu( $args ) {
    	$args[ 'menu' ] = 'test-menu';
    	return $args;
    add_filter( 'thematic_nav_menu_args', 'switch_menu' );

    This code can be extended with conditional tags to load specific menus for a certain template, page, post, and so on.


    Posted 11 years ago #
  2. Hey Chris, thanks for all the hardwork!

    How exactly do we use the second sample code above? Would you be so kind as to fire an example for us?
    Should we still use the register_nav_menu() function in our child themes?

    I took a look at the changelog for the new version and was curious on how do we use the override functions as well :)

    Thanks loads man, you and Gene are great!

    Posted 11 years ago #
  3. Hi Theo,

    yes and no :)

    If you design a child theme for yourself, you don't need to use register_nav_menu(). You know where the child theme calls which menu and what you have to create in the backend.

    If you create a child theme for the masses you have to use register_nav_menu(). This function creates a 'location'. This would be something like register_nav_menu( 'main-menu', __( 'Main Menu' ) ). A location called 'Main Menu' is created in the backend. You still need to define as described above, where this menu is located. Now the user can create a menu and select it for this one location.

    Creating specific menus that are based on conditional tags is possible too:

    register_nav_menu( 'main-menu-home', __( 'Main Menu - Home' ) );
    register_nav_menu( 'main-menu-page', __( 'Main Menu - Page' ) );
    register_nav_menu( 'main-menu-post', __( 'Main Menu - Post' ) );

    Yes .. this can be done with one call and an array ;)

    Now the code for switching the menus:

    function switch_menu( $args ) {
        if (is_single()) {
    	$args[ 'menu' ] = 'main-menu-post';
        } elseif (is_page()) {
    	$args[ 'menu' ] = 'main-menu-page';
        } else {
            // Using this as a fallback for everything else
    	$args[ 'menu' ] = 'main-menu-home';
    	return $args;
    add_filter( 'thematic_nav_menu_args', 'switch_menu' );

    Let me know, if you need more help.


    Posted 11 years ago #
  4. Works great, I updated the thematicclassic, just fine, thanks a lot Chris

    Posted 11 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.