Support » Fixing WordPress » Filter from Categories and possibly sub-categories

  • Hi,

    This is my code I use to filter custom post types:

    <!-- Filter per sub-category -->
    			<h3>Filter your results</h3>
    				$this_category = get_category(get_query_var('cat'),false);
    				$cat_ID = (int)get_query_var('cat');
    				$results = get_categories('&child_of='.$cat_ID.'&hide_empty');
    			<select name="sub-filter" ONCHANGE="location = this.options[this.selectedIndex].value;">
    				foreach ($results as $res){
    					echo '<option value= "';
    					echo network_site_url() . '/category/' . $mylink->slug . '/' . $res->slug ;
    					echo '"'. '>';
    					echo $res->name;
    					echo '</option>';

    What happens there, I have used the default category listing. The top category takes you to the parents taxonomy menu (

    From the above link, you get a dropdown list with all the chocolates (black chocolate, etc).

    However I cannot get the above code to filter some more. How should one go about this?

  • The topic ‘Filter from Categories and possibly sub-categories’ is closed to new replies.