
04-11-2011, 02:28 PM
|
|
Administrator
|
|
Join Date: Aug 2010
Posts: 85
Thanks: 7
Thanked 21 Times in 20 Posts
|
|
Block category from sidebar drop down list
If you are trying to stop a category from showing in your sidebar's drop down this will do the trick.
First down and install the php code widget
This will add a new widget to your list called PHP Code.
Drag the php code widget to the sidebar and past this code inside:
Code:
<form action="<?php bloginfo('url'); ?>/" method="get">
<?php
$select = wp_dropdown_categories('show_option_none=Select category&show_count=1&orderby=name&exclude=XX&echo=0');
$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select); echo $select; ?>
<noscript><input type="submit" value="View" /></noscript>
</form>
Replace the XX with the category number and save. To exclude more than one category, use a comma to separate them (& exclude=XX,XX,XX)
|