• Hi,

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

    <!-- Filter per sub-category -->
    			<h3>Filter your results</h3>
    			<?php
    				//
    				$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;">
    			<?php
    				foreach ($results as $res){
    					echo '<option value= "';
    					echo network_site_url() . '/category/' . $mylink->slug . '/' . $res->slug ;
    					echo '"'. '>';
    					echo $res->name;
    					echo '</option>';
    
    					var_dump($mylink);
    				}
    			?>
    			</select>

    What happens there, I have used the default category listing. The top category takes you to the parents taxonomy menu (www.site.com/category/chocolate).

    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.