Ready to get a little geeky? Okay, maybe a lot geeky?
I am often asked about little tweaks to the average WordPress theme, so I thought I would run through some of the most popular tweaks over the next few posts.
Display Category Dropdown Outside Of Sidebar
Most blog themes will allow you to display your categories in the sidebar. The category widget also has a couple of options like *display as dropdown* or *show hierarchical view*. But how to do you include a category dropdown outside of the sidebar?
Goal
Create a dropdown category list (in hierarchical view) and allow the visitors to click a GO button to see only posts in that category. Place it in the header area of the blog rather than the sidebar.
Code
A couple of notes: I created a style rule for the id “all-categories” so I could apply formatting specific to ONLY this section of the header. This allowed me to float it to the right, set the font size and padding.
Explanation of each element
- <?php bloginfo(“url”); ?>: This instructs WordPress to go get the URL for the current blog page.
- wp_dropdown_categories() is a built in function to allow you to display a drop down list. It takes a single parameter, broken into pieces (shown below):
-
- orderby=name : The most standard of the order by clauses, this says put it in name order. Additional choices are author, date, title, modified, menu_order, parent, ID, rand, and none.
- order=ASC : Using the orderby clause, which direction should it sort? Ascending and descending are your two choices.
- show_count=1 : Do you want to include a number of posts count at the end? 0 = False, and 1 = True
- hierarchical=1 : Do you want to show the list in hierarchical view? (With sub-categories indented under categories). 0 = False and 1 = True
- show_option_all=Category Archives : Text to display for showing an all categories option. Default will not show an option to select all.
- Not shown, but an option: exclude=123,345 : Include this using the ID’s of the categories you don’t want to include and they will not be shown in the dropdown list
- Other options can be found here; http://codex.wordpress.org/Function_Reference/wp_dropdown_categories
Got something you want to see explored or explained? Drop me a comment and I will include it!
About The Author

Cenay Nailor is an Internet, Affiliate and Networking Marketing success coach with mad technical skills she loves sharing. Visit her blog and sign up for a weekly injection of Tech-Based Marketing help, sent right to your inbox. http://www.CenayNailor.com
About The Author

Dali Burgado, also known as "The Dali Blogger" teaches creative entrepreneurs how to carve a web presence that connects with their Inner Guru and their target audience. Her first online marketing love is SEO. She's an avid connector on Facebook, Twitter, and Google+. When she's not coaching or teaching, she's tweaking sites for Search Engine Visibility, working on her PHP and Javascript coding skills, Singing Opera, or learning about gardening. Circle Dali on Google+







9 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
RT @tweetmeme WordPress Theme Tweaks: Dropdown Category : Small Business Internet Marketing and Consulting http://bit.ly/2y6ZdN
This comment was originally posted on Twitter
Man Paul, you must’ve been waiting for the next post, you Tweet’d it moments after I posted it!
Thanks!
Posted: Theme Tweaks: Add Dropdown Category http://tinyurl.com/lpklvu
This comment was originally posted on Twitter
Gorilla marketing in today’s economy is everything, marketing to get through the recession!
If your interested in web optimization for your site, there is a free site for uploading video ads for your business, they also have image uploads if you are not yet up to videos. The more sites you can link to the greater your market will be. They have a free link exchange as well.
 http://adwido.com
Hi everyone, if your starting, or have a small business, and want more customers check out http://adwido.com a free site for uploading video ads for your business,they also have image uploads if you are not yet up to videos. The more sites you can link to the greater your market will be. They have a free link exchange as well.
Hi Cenay, I had a problem.
<form action="” method=”get”>
This is a code, but it only work with last drop-down, the first 2 are not included when submit, can ypu halp me?
@Aiba, I have seen this problem before when there is more than one form on a page (something you should avoid if possible).
The form action should be the URL where the form is located. Also, each input must be within the form tags. In other words,
Please note, I added a space so I could display it here, please remove both spaces in both tags.
I hope this helps.
Continuing the Discussion
Additional comments powered by BackType