I have a Custom Post Type called 'references' with the taxonomy 'references-cats'. Parent and child terms are:
- social media
- corporate communications
- events
- competences
- social media
- events
Some of some of the Child Terms are identical with the Parent Terms. I would like to query all posts of 'social media' (but only the children of 'competences') – is there an exact way to do that?
<?php
$tagz = get_the_title(); // single post title as we are on a single page
query_posts(array(
'post_type' => 'references',
'tax_query' => array(
'relation' => 'AND',
array (
'taxonomy' => 'references-cats',
'field' => 'slug',
'terms' => $tagz, // single post title corresponds with term
),
array(
'taxonomy' => 'references-cats',
'field' => 'slug',
'terms' => 'competences',
'operator' => 'IN'
)
),
'showposts' => 7
) );
?>