I created custom post type 'photo' and custom taxonomy 'catphoto'.
The type 'photo' supports 'catphoto' and 'post_tag' as taxonomies.
Now I should make one filter for a client.
I need to show on taxonomy-catphoto.php page all post_tags
, which belong to the current 'catphoto' item.
For example, I have a post of custom post type 'photo'. The name of this post is 'Plane'. This post belongs to '1961-1981' catphoto item. Also it has post tags like 'space', 'planes', 'stars', 'war'.
Also, for example, I have a post of 'photo' which name is 'Soldier'. It belongs to '1941-1961' catphoto item and has 'WW2', 'USA', 'USSR' like post tags.
And now when I select 1941-1961 catphoto item I should get a list with: WW2 USA USSR
I try like this:
if (substr($_SERVER['REQUEST_URI'],1,8) == 'catphoto'){
$cur_terms = get_terms('post_tag');
if ($cur_terms) {
foreach( $cur_terms as $cur_term ){
echo $cur_term->name.'<br/>';
}
}
}
Now I get all post tags of all catphoto items. How can I fix to restrict for definite catphoto item. For example, '1941-1961' ?