| 1 | 1399,1415d1398 |
|---|
| 2 | < //Custom Taxonomies |
|---|
| 3 | < foreach( $qv as $var => $value ) { |
|---|
| 4 | < if( ( $pos = strpos( $var, '__in' ) ) && $var != 'tag__in' && $var != 'category__in' && $var != 'post__in' && $var != 'tag_slug__in' ) { |
|---|
| 5 | < $custom_taxonomies[ $var ] = substr( $var, 0, $pos ); |
|---|
| 6 | < } |
|---|
| 7 | < elseif( ( $pos = strpos( $var, '__not_in' ) ) && $var != 'tag__not_in' && $var != 'category__not_in' && $var != 'post__not_in' ) { |
|---|
| 8 | < (array) $this->custom_taxonomies__not_in[ $var ] = substr( $var, 0, $pos ); |
|---|
| 9 | < } |
|---|
| 10 | < } |
|---|
| 11 | < |
|---|
| 12 | < foreach( (array) $custom_taxonomies as $var => $custom_tax ) { |
|---|
| 13 | < $item = 'is_' . $custom_tax; |
|---|
| 14 | < $this->$item = true; |
|---|
| 15 | < (array) $qv[$var]; |
|---|
| 16 | < } |
|---|
| 17 | < $this->custom_taxonomies = (array) $custom_taxonomies; |
|---|
| 18 | < |
|---|
| 19 | 1922,1940c1905 |
|---|
| 20 | < //Custom Taxonomies |
|---|
| 21 | < foreach( (array) $this->custom_taxonomies as $var => $custom_tax ) { |
|---|
| 22 | < $join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) "; |
|---|
| 23 | < $reqtag = is_term( $q[$var][0], $custom_tax ); |
|---|
| 24 | < $distinct = 'DISTINCT'; |
|---|
| 25 | < } |
|---|
| 26 | < |
|---|
| 27 | < //Custom Taxonomy Not In |
|---|
| 28 | < foreach( (array) $this->custom_taxonomies__not_in as $var => $custom_tax ) { |
|---|
| 29 | < if ( $wpdb->has_cap( 'subqueries' ) ) { |
|---|
| 30 | < $tax_string = "'" . implode("', '", $q[$var]) . "'"; |
|---|
| 31 | < $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = '$custom_tax' AND tt.term_id IN ($tax_string) )"; |
|---|
| 32 | < } else { |
|---|
| 33 | < $ids = get_objects_in_term($q[$var], $custom_tax); |
|---|
| 34 | < if ( !is_wp_error($ids) && is_array($ids) && count($ids) > 0 ) |
|---|
| 35 | < $whichcat .= " AND $wpdb->posts.ID NOT IN ('" . implode("', '", $ids) . "')"; |
|---|
| 36 | < } |
|---|
| 37 | < } |
|---|
| 38 | < |
|---|
| 39 | < // Tag and slug intersections. Also merge with custom taxonomies |
|---|
| 40 | --- |
|---|
| 41 | > // Tag and slug intersections. |
|---|
| 42 | 1942d1906 |
|---|
| 43 | < $intersections = array_merge( $intersections, (array) $this->custom_taxonomies ); |
|---|
| 44 | 1945a1910 |
|---|
| 45 | > if ( in_array($item, $tagin) && empty($q['cat']) ) continue; // We should already have what we need if categories aren't being used |
|---|
| 46 | 1953c1918 |
|---|
| 47 | < $taxonomy_field = $item != ('tag_slug__and' || 'tag_slug__in') ? 'slug' : 'term_id'; |
|---|
| 48 | --- |
|---|
| 49 | > $taxonomy_field = $item == ('tag_slug__and' || 'tag_slug__in') ? 'slug' : 'term_id'; |
|---|