WordPress.org

Ready to get started?Download WordPress

Forums

Add Categories drop down to menu nav (12 posts)

  1. jimmypader
    Member
    Posted 3 years ago #

    I want to add a drop down menu to the nav bar.
    I currently am using a wordpress menu (appearance>menus) with custom css.

    I want to add another item named 'Products'. I want it to display the categories.

    It would function much like the categories widget. Check box to 'Display as Dropdown'. 'Title' box so I can rename it.

    Is this possible?

    If not, I will probably turn off the menu and hard code something into header.php.

    Here's my site about mountain laurel handrails http://awoodrailing.com

  2. Megan Goodson
    Member
    Posted 3 years ago #

    It is very possible, in fact I just implemented one myself for a company website. It's very easy to do. Go back to your "menu's" and make a new one and underneath the box where you'd usually add pages into the menu should be a box that says or lists your categories. :) Then you just check the boxes beside the categories you want added and click add (the same way you'd add a page to a menu). Then go to your widgets page and make a new navigation widget using your newly created category driven menu! :)

    I hope this helps. If not I can try and put some pictures with it!

    Good Luck
    Megan

  3. esmi
    Forum Moderator
    Posted 3 years ago #

    Um - I think jimmypaderwants to display a single custom nav menu and then a category dropdown as well. In theory, that's possible too if you add a widget-ready area to the right of your nav menu block and then use the Category widget from Appearance->Widgets.

  4. jimmypader
    Member
    Posted 3 years ago #

    yes esmi. that is what I had in mind.

    but it appears a little more complicated than I had in mind.

    I'd like the category drop down to be part of the custom menu.
    This functionality does not appear to exist currently.

    If I added a widget area to the right of the nav I'd have to style it as well to match the actual nav menu...

    I was playing last night with hard coding the nav bar into the header.php and using something like the below to call the categories. I didn't get through fixing the css but this seems to have a good chance of working.

    what do you think?

    <li id="products"><?php _e('Products:'); ?>
    	<ul>
    <?php wp_list_cats(); ?>
    	</ul>
  5. esmi
    Forum Moderator
    Posted 3 years ago #

    Does your current custom menu support dropdowns at all?

  6. jimmypader
    Member
    Posted 3 years ago #

    using modified 2010
    appearance>menus

    I do not see any dropdown functionality

  7. esmi
    Forum Moderator
    Posted 3 years ago #

    Thinking on this some more...

    If I added a widget area to the right of the nav I'd have to style it as well to match the actual nav menu

    If you are comfortable tweaking CSS, that should be a relatively trivial job (for various definitions of the word "trivial").

    I was playing last night with hard coding the nav bar into the header.php

    Why not use wp_dropdown_categories and let WP do the drudge work?

  8. esmi
    Forum Moderator
    Posted 3 years ago #

    using modified 2010

    I do hope that this is a child theme...

    I do not see any dropdown functionality

    The original Twenty Ten theme menu supports dropdowns. Try adding a sub-page to your current custom nav menu and you should see what I mean.

  9. DeirdreBunny
    Member
    Posted 2 years ago #

    Greetings,

    I have a similar issue. I have a client that I designed and built a WordPress site for, using a modified theme a few years ago. I think that may have been the TwentyTen theme. Today he emailed me asking if I could have his blog categories listed as a drop-down menu from the blog link on the main navbar. I know how to add pages as a drop down, by choosing a parent page, but I have no idea how to add a list of his blog categories as a drop-down on his navigation bar.

    I thought that maybe custom menus would save me, but under Appearance/Menus, I am seeing the following notice:

    The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.

    I looked at the wp_dropdown_categories, but I'm not sure this will do what I need, or if it will, how to implement it. Any advice on how I might go about adding categories as a drop down from the navbar (preferably under the blog menu item on the navbar).

    Thanks in advance!
    Deirdre

  10. jimmypader
    Member
    Posted 2 years ago #

    Deirdre, I ended up doing it in html and css
    if you go to my site, http://awoodrailing.com you can see the html and css under:: div id="nav".

    this was much easier to me than the wp_dropdown_categories call because I still had to style the call and its output.

  11. DeirdreBunny
    Member
    Posted 2 years ago #

    Thanks Jimmy - I'll take a look!

  12. DeirdreBunny
    Member
    Posted 2 years ago #

    I ended up adding a function to enable custom menus for the theme, then created the new menu items and drop downs through Appearance/Menus. Finally, I renamed the elements in my CSS to match the classes and IDs for the new menu.

    Here's the code I added to function.php

    add_action('init', 'register_custom_menu');
    
    function register_custom_menu() {
    register_nav_menu('custom_menu', __('Custom Menu'));
    }

    Hat tip to: Think Vitamin

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.