Boca Raton Real Estate

Top Ad unit 728 × 90

Home Plugins provides Using Code WordPress Display Categories in a Drop Down Menu

Display Categories in a Drop Down Menu

Unknown 1:56 AM Plugins, provides, Using Code, WordPress

Some blogs have a lot of categories which they can’t display in their sidebar. Or some bloggers do not want to take up a lot of space displaying categories. This option allows them to have a select menu, dropdown menu, for categories. SeeWordPress Codex for details.
view source
print?
1<form action="<?php bloginfo('url'); ?>/" method="get">
2<?php
3$select = wp_dropdown_categories('show_option_none=Select Category&show_count=1&orderby=name&echo=0&selected=6');
4$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
5echo $select;
6?>
7<noscript><input type="submit" value="View" /></noscript>
8</form>

A long standing pain point I’ve had with WordPress is the inability to use the menu administration area to easily add a dropdown list of categories to my theme’s main menu. While the menu system provides the means to add categories to a menu, it doesn’t contain a way to easily create a dropdown list of categories. Thankfully, there is an easy work around that accomplishes the goal without using code. Thanks to Sami Keijonen who told me about this technique on the ThemeHybrid support forums.
Start by browsing to Appearance – Menus. Select the menu where you want the link to be displayed. Create a new Link menu item and use # as the URL with the link text of categories. Then click the Add to Menu button.
Select which categories you want to be displayed within the dropdown list. After you add the categories to the menu, make sure to drag and drop them so that they are a child link underneath the parent menu of categories. Look at the following screenshot for reference.
After you’ve arranged the category links, save the menu. Visit your front page and hover over the categories link to make sure the dropdown list works correctly. The parent menu item of categories acts as a placeholder which is the ingenious part of the tutorial.
By using this technique, I can modify which categories and what order they are displayed using the WordPress menu manager. I don’t have to worry about it disappearing via plugins or by switching themes. Thanks again to the always helpful, friendly, ThemeHybrid support forums for this tip.
Display Categories in a Drop Down Menu Reviewed by Unknown on 1:56 AM Rating: 5

Tags :

Plugins provides Using Code WordPress
  • Tweet
  • Share
  • Share
  • Share
  • Share
Unknown

About Sweetheme

Number of Entries : 35

We are Developers Team do our best to create beautiful work for our clients. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

WordPress

No comments:

Subscribe to: Post Comments (Atom)
Contact us
All Rights Reserved by Boca Raton Real Estate © 2014 - 2015
Powered By Blogger, Designed by Sweetheme

Contact Form

Name

Email *

Message *

Powered by Blogger.