ThemeShaper Forums » Thematic


How to add additional menu?

(8 posts)
  • Started 5 years ago by divago
  • Latest reply from em hr
  • This topic is resolved
  1. divago


    i am using matteostagi's method for the menu of my child theme (
    Now i am trying to create another little menu above the main one, that i moved upside, but i really don't know how can i do that.
    Sorry but this is my first thematic child template and there is so much to learn...

    Any idea on how this can be solved? Thanks.

    Posted 5 years ago #
  2. Well, I'd start by finding the place where you want to insert the menu. Maybe something like this:

    function secondarymenu() {
         echo 'New Menu Goes Here';
    add_action('thematic_header','secondarymenu', 1);

    Where I have 1, you could put 4 or 6 etc, depending on where you want the menu (ie add_action('thematic_header','secondarymenu', 8);) Then update your syntax so it is an actual menu and style it.

    Posted 5 years ago #
  3. while matt's idea is brilliant, it is sort of outdated now that you can build custom menus in WP3.0

    in terms of 2 menus i had this on a test blog that never got finished :

    /* ********************************************** */
    /* MENUS */
    /* ********************************************** */
    // 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_my_menus() {
    			'primary-menu' => __( 'Primary Menu' ),
    			'secondary-menu' => __( 'Secondary Menu' ),
    add_action( 'init', 'register_my_menus' );
    // We remove the standard Thematic menu
    function remove_menu() {
    add_action('init', 'remove_menu');
    // We create the new wp_nav_menu called "Primary Menu" in our theme
    function child_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.  */ ?>
    			 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
    									//'fallback_cb' => '',
    	</div><!-- #access -->
    function secondary_menu() {
    if ( has_nav_menu( 'secondary-menu' ) ) { ?>
    	<div id="nav-container">
    		<?php wp_nav_menu( array( 'theme_location' => 'secondary-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
    		) ); ?>
    <?php }

    it worked as far as i can recall. but i doubt it is the most elegant code you will ever see. you mileage may definitely vary.

    Posted 5 years ago #
  4. Hi,

    please use:

    add_theme_support( 'menus' );

    instead of:

    add_theme_support( 'nav-menus' );

    This is one of the last minute changes in WP 3.0


    Posted 5 years ago #
  5. divago

    Thank you very much Helga and Chris !!!!!!!
    i'll save your suggestions for some other work..
    I am still using WP2.9.2 and i used something like Devin's method

    function secondary_menu() { ?>
    <div id="beforebranding">
    <?php }
    add_action('thematic_header','secondary_menu', 2);


    Posted 5 years ago #
  6. Cezar

    @helga - i think it also requires css changes for top menu to work with sub navigation

    Posted 5 years ago #
  7. @Cezar - i'm not sure what you mean, but if you assign the same css classes used in the default #access menu then it should look and function exactly the same way.

    Posted 5 years ago #
  8. Hi,

    Heads up using add_theme_support in this way is not advised



    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.