Plugin Directory

Changeset 649792


Ignore:
Timestamp:
01/08/2013 04:51:56 PM (13 years ago)
Author:
jascott
Message:

API term filtering for inclusive/exclusive queries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kickpress/trunk/kickpress-functions.php

    r649791 r649792  
    271271        $post_type = '';
    272272   
    273 
    274273    $term = kickpress_normalize_term($term);
    275274
     
    279278        $taxonomies = array_keys( $term );
    280279        $taxonomy = $taxonomies[0];
    281 
    282         $terms = $term[$taxonomy]['in'];
    283280       
    284281        $single_term = count( $term[$taxonomy] ) == 1;
     282       
     283        if ( $single_term ) {
     284            $operators = array_keys( $term[$taxonomy] );
     285            $operator  = $operators[0];
     286           
     287            $terms = $term[$taxonomy][$operator];
     288           
     289            $single_term = count($terms) == 1;
     290        }
    285291    }
    286292   
     
    408414        unset( $term['relationship'] );
    409415       
    410         foreach ( $term as $taxonomy => $terms ) {
    411             if ( is_array( $terms ) )
    412                 $terms = implode( ',', $terms );
    413            
    414             $api_slugs[] = "term[{$taxonomy}]";
    415             $api_slugs[] = $terms;
     416        foreach ( $term as $taxonomy => $taxonomy_terms ) {
     417            foreach ( $taxonomy_terms as $operator => $terms ) {
     418                $api_slugs[] = "term[{$taxonomy}][{$operator}]";
     419                $api_slugs[] = implode( ',', $terms );
     420            }
    416421        }
    417422    }
Note: See TracChangeset for help on using the changeset viewer.