ThemeShaper Forums » Thematic

[closed]

How to Style Custom Menu Like Main Menu

(12 posts)
  • Started 2 years ago by danromanchik
  • Latest reply from danromanchik
  • This topic is not resolved
  1. danromanchik
    Member

    I have a site with the main menu running across the top. By reading the great postings here, I've been able to get the styling just right including background colors, rollovers, and drop-downs.

    I have also created a secondary navigation menu, and, using the Custom Widget sidebar, I have put this menu in the secondary aside. What I'd really like to do, however, is to use the styling of the main menu on this secondary menu, so that the rollovers and drop-downs work just like they do for the main menu.

    How do I do this?

    Thanks, Dan

    Posted 2 years ago #
  2. to have the same style you need to use the same class. so the UL element needs the class sf-menu i'm not sure this is possible with a widget. you might be better-served by registering a secondary menu location and adding it to a hook

    Posted 2 years ago #
  3. danromanchik
    Member

    Dang. If helga doesn't know how to do it, do I have any hope? :)

    Posted 2 years ago #
  4. registering a secondary menu location and adding it to a hook

    ...is the winning combo IMO

    Posted 2 years ago #
  5. lol! thanks for the vote of confidence @danromanchik.

    Posted 2 years ago #
  6. danromanchik
    Member

    The reason that I opted to go with the widget approach is that I want different menus to show up on different pages. Can I still do this by registering different menus?

    Posted 2 years ago #
  7. You can register as many menus as you like. When you add them in to an action hook you'll need to set a condition for the menu appearing or not.

    Posted 2 years ago #
  8. fwunder
    Member

    Not sure if it will help in @danromanchik's case, but I use Dynamic Widgets => http://wordpress.org/extend/plugins/dynamic-widgets/

    It gives me very easy and granular control over custom menu(s) placements.

    Posted 2 years ago #
  9. i'd still do it w/ the registering of menus since you cannot filter the UL class into the wp_nav_menu() args for the widget. i just checked.

    you can add different menus on different pages w/ conditional logic
    http://codex.wordpress.org/Conditional_Tags

    for instance if you register three menus: category-menu, page-menu and extra-menu:

    function kia_conditional_menus(){
       if(is_category()){
           wp_nav_menu(array('theme_location'  => 'category-menu','menu_class' => 'sf-menu'));
       } elseif (is_page()){
           wp_nav_menu(array('theme_location'  => 'page-menu','menu_class' => 'sf-menu'));
       } else {
           wp_nav_menu(array('theme_location'  => 'extra-menu','menu_class' => 'sf-menu'));
      }
    }
    add_action('thematic_abovemainasides','kia_conditional_menus');

    untested so if you get a white screen of death it could be syntax, but assuming no parse errors it should work

    Posted 2 years ago #
  10. danromanchik
    Member

    Thanks again for all the info. Just now getting back to this. I hired a CSS specialist to do the styling, and he's done a great job, but now needs a little coding support.

    I take it that the line:
    add_action('thematic_abovemainasides','kia_conditional_menus');

    will add the menu(s) to the secondary aside. This is not intuitive from the description (or lack thereof) of these hooks on the Theme Hooks wiki page.

    So, just to double check on what I need to do:
    1. Remove the custom menu widgets I'm currently using.
    2. Register the menus.
    3. Add a function similar to the kia_conditional_menus() function above to functions.php.
    3. Connect the menus I created on the Menus page to the desired theme locations.

    Posted 2 years ago #
  11. sounds right. give it a whirl and report back w/ any problems.

    also, see: http://visualizing.thematic4you.com/

    thematic_abovemainasides will come before #primary

    Posted 2 years ago #
  12. danromanchik
    Member

    Well, I think I got it knocked. I had to add the action to thematic_abovecontent to get the code placed properly, and the CSS guy still needs to play with the CSS, but I think this is going to work. :)

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.