how to add a second menu LOCATION
ThemeShaper Forums » Thematic
Menu Location
(4 posts)-
Posted 1 year ago #
-
This was a great help to me
http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus
http://themeshaper.com/forums/topic/thematic-menus-demystified-1
Posted 1 year ago # -
I have been looking also for information on creating more menus.
I read the info Wayne mentioned.Here goes...
I put the code from #5 thematic-menus-demystified-1 post in my thematic child function file. The example added top-menu and I added an additional footer-menu. I just copied and pasted the top-menu code and replace footer anywhere top was. Now the theme will have 3 menu areas.
/// Register the new menus function register_my_menus() { register_nav_menus( array( 'primary-menu' => __( 'Primary Menu' ), 'top-menu' => __( 'Top Menu' ), 'footer-menu' => __( 'Footer Menu' ), ) ); } add_action( 'init', 'register_my_menus' ); ///Top Menu (optional) function top_menu() { if ( has_nav_menu( 'top-menu' ) ) { wp_nav_menu( array( 'theme_location' => 'top-menu', 'container_id'=>'top-menu', 'container_class' => 'clearfix ', 'menu_class' => 'sf-menu', // we assign the sf-menu class to the menu ul so that superfish works on this menu too ) ); } } add_action('thematic_aboveheader','top_menu'); ///Footer Menu (optional) function footer_menu() { if ( has_nav_menu( 'footer-menu' ) ) { wp_nav_menu( array( 'theme_location' => 'footer-menu', 'container_id'=>'footer-menu', 'container_class' => 'clearfix ', 'menu_class' => 'sf-menu', // we assign the sf-menu class to the menu ul so that superfish works on this menu too ) ); } } add_action('thematic_abovefooter','footer_menu');I looked at http://www.bluemandala.com/thematic/thematic-structure.html to find an action hook to position the bottom footer menu. I selected thematic_abovefooter.
I made some changes in the style.css to adjust the top-menu and the footer-menu.
#top-menu, #footer-menu { width: 940px; margin: 0 auto; } #top-menu .sf-menu { float:right; } #header{ clear:both; }I went to Menu in the wordpress interface and created new menus for footer and top.
Both top and footer menus are only one level for my needs.I played with the helgatheviking's #6 "styling the beast" to find out how to move the top nav to the right side. Changing .sf-menu from float left to right did the trick.
I am not sure what .clearfix does. I have just started to dig into the theme.
Should I remove the sf-menu class if I do not need the dropdown option. Should I just remove the line starting with 'menu_class'?
How would I add an additional class for each new menu for styling?
If there is a better way to add menus, please enlighten me.
Posted 1 year ago # -
the above is pretty spot on.
you need to add another class for styling? just replace sf-menu (if ya not going to use superfish) to the class you require, i guess.
i'm sure the clearfix is there to clear floats for the nav li's.
but you'll need to include the clearfix css in your stylesheet.Posted 1 year ago #
Reply
You must log in to post.