View Full Version : WordPress Help: Drop Down List
CaraM
September 27th, 2009, 09:14 PM
I want to create a drop down list of the categories on my blog in my nav bar.
(see http://thehouseholdhelper.com/blog - right hand side of nav bar)
I've tried a couple plugins with no success.
Does anyone have any ideas of how I can do this? I really want to get the categories up there and remove the sub-nav bar because it looks messy (plus, it's not consistent with my main site).
Thanks much in advance!
Cara
TraciKnoppe
September 28th, 2009, 08:55 AM
Yep, use the categories widget, check the box that says 'show as dropdown'. :)
TraciKnoppe
September 28th, 2009, 11:05 AM
Tim - your solutions would work, IF she were wanting to keep the navigation as horizontal at the top of the page; but she mentioned she was wanting to move the categories to the sidebar to keep the design in line with the rest of her site. A sidebar category dropdown is simple with the category widget - no special coding needed. :)
Lynn Terry
September 28th, 2009, 12:40 PM
The only potential concern would be losing the internal text links. Most drop down box options will not allow the search engines to "read" the category links. It also requires visitors to take an action to see more of what you offer (clicking the drop down option).
TraciKnoppe
September 28th, 2009, 01:24 PM
The only potential concern would be losing the internal text links. Most drop down box options will not allow the search engines to "read" the category links. It also requires visitors to take an action to see more of what you offer (clicking the drop down option).
Yep, definitely more clicks. I agree, from that standpoint - dropdowns aren't the best. I believe you should only have as many categories as you need (all keyword optimized for a broader/general phrase).
However, search engines can still read the categories easily from within a WordPress widget dropdown.
Here's an example of widget code using no dropdown:
<div id="categories-3" class="widget widget_categories"><h3 class="widgettitle">Chicken Scratch Categories</h3> <ul>
<li class="cat-item cat-item-4"><a href="http://raisingbackyardchickens.info/category/breeds-of-chickens/" title="View all posts filed under Breeds of Chickens">Breeds of Chickens</a>
</li>
<li class="cat-item cat-item-6"><a href="http://raisingbackyardchickens.info/category/chicken-coops/" title="View all posts filed under Chicken Coops">Chicken Coops</a>
</li>
<li class="cat-item cat-item-11"><a href="http://raisingbackyardchickens.info/category/newsworthy-chicken-scratch/" title="View all posts filed under Newsworthy Chicken Scratch">Newsworthy Chicken Scratch</a>
</li>
<li class="cat-item cat-item-19"><a href="http://raisingbackyardchickens.info/category/pet-chickens/" title="View all posts filed under Pet Chickens">Pet Chickens</a>
</li>
<li class="cat-item cat-item-3"><a href="http://raisingbackyardchickens.info/category/raising-backyard-chickens/" title="View all posts filed under Raising Backyard Chickens">Raising Backyard Chickens</a>
</li>
</ul>
</div>
Now here's the same site, only using the dropdown feature in the widget:
<div id="categories-3" class="widget widget_categories"><h3 class="widgettitle">Chicken Scratch Categories</h3><select name='cat' id='cat' class='postform' >
<option value='-1'>Select Category</option>
<option class="level-0" value="4">Breeds of Chickens</option>
<option class="level-0" value="6">Chicken Coops</option>
<option class="level-0" value="11">Newsworthy Chicken Scratch</option>
<option class="level-0" value="19">Pet Chickens</option>
<option class="level-0" value="3">Raising Backyard Chickens</option>
</select>
<script type='text/javascript'>
/* <![CDATA[ */
var dropdown = document.getElementById("cat");
function onCatChange() {
if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
location.href = "http://raisingbackyardchickens.info/?cat="+dropdown.options[dropdown.selectedIndex].value;
}
}
dropdown.onchange = onCatChange;
/* ]]> */
</script>
</div>
Even though it did add the javascript below, the category headings are still clearly visible and readable by the search engines.
Lynn Terry
September 29th, 2009, 06:10 AM
I see the category headings in the code, but I don't see the URL's for them - which is what Google needs to see in order to follow. Unless I'm missing something?
TraciKnoppe
September 29th, 2009, 06:42 AM
Yep true enough. Just the category headings.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.