Get taxonomy of a post for single.php
-
I have searched the forum for the past few hours now and can’t seem to find what I am looking for, i am beginning to think this is not possible.
I have a custom post type ‘project’ within this post type I have two taxonomies which each have 3 terms similar to below:
‘project’
-> ‘houses’
–> coastal
–> country
–> urban
-> ‘gardens’
–> coastal
–> country
–> urbanWhen I click on a project I need to find the taxonomy and the term in order for my query to work on single.php query below:
$args = array( 'posts_per_page' => -1, 'post_type' => 'projects', 'tax_query' => array( array( 'taxonomy' => $my_taxonomy, 'field' => 'slug', 'terms' => $my_term ) ) );
So in order for this query to work I need $my_taxonomy and $my_term, again not sure if it is possible i have found many topics where people have been looking to get the terms by using the taxonomy but I don’t have the taxonomy and want my single.php to be dynamic.
Thanks
- The topic ‘Get taxonomy of a post for single.php’ is closed to new replies.