ThemeShaper Forums » Thematic

[closed]

Add secondary menu in footer?

(5 posts)
  • Started 12 years ago by Pictrix
  • Latest reply from Pictrix
  • This topic is resolved

Tags:

  1. Pictrix
    Member

    I would like to use the wordpress menus to create a secondary menu contained in a div within the footer.

    I've followed Helgatheviking's excellent post http://forums.themeshaper.com/topic/thematic-menus-demystified-1 and I've managed to place a secondary menu in the footer. However, being no PHP expert, I don't know how to place it within a containing div and how to locate it in a specific place within the customized footer.php file that I'm using.

    I will greatly appreciate any suggestions!

    Posted 12 years ago #
  2. well it is automatically IN a div of its own. i think what you are after is determining the correct 'priority' number. existing functions in the thematic_footer, in order:

    10 - thematic_subsidiaries
    20 - thematic_siteinfoopen
    30 - thematic_siteinfo
    40 - thematic_siteinfoclose

    where is your menu currently appearing and where would you prefer it to appear? also, out of curiosity, what you doing that requires a modded footer.php?

    Posted 12 years ago #
  3. Pictrix
    Member

    Helga,
    I am just temporarily using the footer template because I’m still moving things around and eventually all of it will go to functions.php, which is very long by now.

    I have a series of containing divs within thematic_abovefooter(), and the secondary menu would be the second or third one.

    I assume that in order to place the secondary menu where I want it, I need something in the fashion of :

    if ((function_exists('has_nav_menu(secondary-menu)'))

    echo [something that will display the secondary menu]

    However, whatever I’ve tried so far hasn’t worked.

    I'm currently using your code, which I modified slightly to read secondary-menu instead of top-menu:

    function register_my_menus() {
    register_nav_menus(
    array(
    'primary-menu' => __( 'Primary Menu' ),
    'secondary-menu' => __( 'Secondary Menu' ),

    )
    );
    }
    add_action( 'init', 'register_my_menus' );

    // Then, place a secondary menu in the footer
    function secondary_menu() {

    if ( has_nav_menu( 'secondary-menu' ) ) {
    wp_nav_menu( array( 'theme_location' => 'secondary-menu',
    'container_id'=>'secondary-menu',
    'container_class' => 'clearfix ',
    'menu_class' => 'sf-menu', // Assign the sf-menu class to the menu ul so that superfish works on this menu too
    ) );

    }
    }

    add_action('thematic_abovefooter','secondary_menu');

    Posted 12 years ago #
  4. you'd use wp_nav_menu(). copied straight from justin tadlock's post on menus
    http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus

    if ( has_nav_menu( 'primary-menu' ) ) { ?>
    
    	<div class="nav-container">
    		<?php wp_nav_menu( array( 'theme_location' => 'primary-menu' ) ); ?>
    		<?php get_search_form(); ?>
    	</div>
    
    }

    but if you stop overwriting footer.php (is the thematic_abovefooter hook in your version?) then the code from my menus demystified thread (which you , at first glance, appear to be using correctly) should work.

    if functions.php gets really long, you could do what i do and seperate them into different files, and just require them in your functions.php. see my new post:

    http://forums.themeshaper.com/topic/how-to-keep-organized-when-functionsphp-gets-uber-long#post-18182

    Posted 12 years ago #
  5. Pictrix
    Member

    This is exactly what I was looking for! Thanks so very much!

    And yes, functions.php is so long that it's become extremely difficult to navigate. I'll definitely follow your advice on how to break it into smaller files. Again, you provided me with just the advice I desperately needed!

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.