Query Multiple Taxonomies
[Plugin: Taxonomy Drill-Down] Searching only one term displays all terms, query_posts($args); questi (1 post)

  1. Ethan Shaw
    Posted 4 years ago #

    I'm having a problem displaying search results when only one taxonomy is searched for; other terms that were not search for are being included in the loop. If two or more taxonomies are searched everything is fine. Do you have any thoughts on what could be wrong?

    @Scribu thank you for creating such an awesome plugin, this was exactly what I needed!

    Here is my taxonomy.php template file:

     * @package WordPress
     * @subpackage OpenSky
    	$sctaxsearch_year = $_GET['year'];
    	$sctaxsearch_make = $_GET['make'];
    	$sctaxsearch_model = $_GET['model'];
    	$args_forsale = array('taxonomy' => 'scct_i_status', 'terms' => 'for-sale', 'field' => 'slug');
    	if ($sctaxsearch_year):
    		$args_year = array('taxonomy' => 'scct_i_year', 'terms' => $sctaxsearch_year, 'field' => 'slug'); endif;
    	if ($sctaxsearch_make):
    		$args_make = array('taxonomy' => 'scct_i_make', 'terms' => $sctaxsearch_make, 'field' => 'slug'); endif;
    	if ($sctaxsearch_model):
    		$args_model = array('taxonomy' => 'scct_i_model', 'terms' => $sctaxsearch_model, 'field' => 'slug'); endif;
    	get_header(); get_template_part('template_top'); ?>
    <section class="hfeed page grid_20 prefix_2 suffix_2" role="main">
      <div id="theloop" style="margin-left:-40px; background-color:white" itemscope itemtype="http://data-vocabulary.org/Product">
    	$args['tax_query'] = array($args_year, $args_make, $args_model, $args_forsale, 'post_type' => 'inventory', 'posts_per_page' => 20,);
    	query_posts($args); while ( have_posts() ) : the_post();
        <article class=" clickdiv"  itemprop="offerDetails" itemscope itemtype="http://data-vocabulary.org/Offer">
          <header style="height:33px; width:875px" class="greybar_top">
            <?php get_template_part('includes/inventory_header'); ?>
          <div class="clear"></div>
          <section class="greybar_middle" style="margin-top:-1px; margin-bottom:0; width:875px; height:160px">
            <?php get_template_part('includes/inventory_infotable'); ?>
          <?php endwhile; ?>
          <footer style="height:3px; width:875px" class="greybar_bottom">&nbsp;</footer>
        <div class="clear"></div>
    <?php get_template_part('template_bottom'); get_footer(); ?>


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Query Multiple Taxonomies
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic