Support » Themes and Templates » DB query function – Show only items belonging to a category

  • In a site under development, based on a template whose author does not give any support, happens that when one family is chosen from the nav menu, ALL THE ITEMS of the whole DB are shown by default (the button ‘todos’), while I would like that only items belonging to that family appear in the page, of any category.
    The bit of code for the categories menu is this:

    <?php wp_list_categories(array('title_li' => '', 'exclude' => $excludecat,'taxonomy' => 'skill-type', 'walker' => new Walker_Category_Filter())); ?>

    and the array:

    <?php $args = array(
    	'post_type' => 'portfolio',
    	'orderby'=>'menu_order',
    	'order'     => 'ASC',
    	'posts_per_page' => '-1',
    	'skill-type' => get_query_var('skill-type'),
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'skill-type',
    			'field' => 'id',
    			'terms' => $excludecat,
    			'operator' => 'NOT IN',
    			)
    		) // end of tax_query
    	);
    ?>

    Any idea about how to achieve the wished result? Tia

  • The topic ‘DB query function – Show only items belonging to a category’ is closed to new replies.