WordPress.org

Plugin Directory

Changeset 628704


Ignore:
Timestamp:
11/22/12 15:52:32 (17 months ago)
Author:
scribu
Message:

deploy from git

Location:
query-multiple-taxonomies/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • query-multiple-taxonomies/trunk/query-multiple-taxonomies.php

    r611580 r628704  
    22/* 
    33Plugin Name: Query Multiple Taxonomies 
    4 Version: 1.6.2 
     4Version: 1.6.3-alpha 
    55Description: Filter posts through multiple custom taxonomies using a widget. 
    66Author: scribu 
  • query-multiple-taxonomies/trunk/walkers.php

    r611580 r628704  
    3434            ) 
    3535        ); 
     36 
    3637        $count_filter = array(); 
    37         //add info from current item 
    38         $count_filter[$this->taxonomy] = array($this->term->slug); 
    39         // Considering previous choices 
    40         foreach ($old_query as $old_taxonomy => $old_terms){ 
    41             $terms = explode('+', $old_terms); 
    42             //put it into the count_filter array which we will use to generate our count query 
    43             if (!isset($count_filter[$old_taxonomy])){ 
    44                 //Assure we have this array 
     38 
     39        $count_filter[ $this->taxonomy ] = array( $this->term->slug ); 
     40 
     41        // considering previous choices 
     42        foreach ( $old_query as $old_taxonomy => $old_terms ) { 
     43            $terms = explode( '+', $old_terms ); 
     44 
     45            if ( !isset( $count_filter[$old_taxonomy] ) ) { 
    4546                $count_filter[$old_taxonomy] = $terms; 
    46             }else{ 
    47                 $count_filter[$old_taxonomy] = array_merge ($count_filter[$old_taxonomy] , $terms); 
     47            } else { 
     48                $count_filter[$old_taxonomy] = array_merge( $count_filter[$old_taxonomy], $terms ); 
    4849            } 
    4950        } 
     51 
    5052        // now use all this for the query 
    51  
    52         foreach ($count_filter as $tax => $terms){ 
     53        foreach ( $count_filter as $tax => $terms ) { 
    5354            $query['tax_query'][] = array ( 
    5455                'taxonomy' => $tax, 
    5556                'field' => 'slug', 
    5657                'terms' => $terms, 
    57                 'include_children' => 0, 
    58                 'operator' => 'AND' 
     58                'include_children' => true, 
     59                'operator' => 'IN' 
    5960            ); 
    6061        } 
Note: See TracChangeset for help on using the changeset viewer.