Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: Hierarchical taxonomy display question

$
0
0

Hi Kristin,

You are right, View taxonomy filter will include all child term post defaultly, you can try views filter hook to alter it, like this:

Add codes in your theme/functions.php

add_filter('wpv_filter_query', 'taxonomy_view_func', 10, 2);
function taxonomy_view_func($query, $setting) {
    if($setting['view_id'] = 123)
	{
		if(isset($query['tax_query']))
		{
			foreach($query['tax_query'] as $k => $v)
			{
				if(isset($v['taxonomy']) && $v['taxonomy'] == 'category')
				{
					$query['tax_query'][$k]['include_children'] = false;
					break;
				}
			}
		}
	}
    return $query;
}

Please replace 123 with your VIEW #3 post ID, replace "category" with your custom Taxonomy slug.

More help:
Views Filters – Extend Views
http://wp-types.com/documentation/user-guides/views-filters/
include_children
http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters


Viewing all articles
Browse latest Browse all 20145

Trending Articles