WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Ethan Shaw
    Member
    Posted 3 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:

    <?php
    /**
     * @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">
        <?php 
    
    	$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'); ?>
          </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'); ?>
          </section>
          <?php endwhile; ?>
          <footer style="height:3px; width:875px" class="greybar_bottom">&nbsp;</footer>
        </article>
        <div class="clear"></div>
      </div>
    </section>
    <?php get_template_part('template_bottom'); get_footer(); ?>

    http://wordpress.org/extend/plugins/query-multiple-taxonomies/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic