Justin Cline
Member
Posted 2 years ago #
Ok, I've searched high and low and I'm not finding this.
I'm using custom posts and custom taxonomies to add a "portfolio" section with project 'types' (using types, the same way one would normally use categories.
I was to display projects in the same category at the bottom of a single page. I have the display working when I manually add the project 'type' slug. I'm not finding a way to dynamically pull the current post's 'type' (there will be only one) and show relevant others. Any help would be awesome. I can't believe this is so hard.
Maybe my tutorial on displaying CPT's and custom taxonomies could help you
http://greatdanemaniac.com/tutorials-2/
Justin Cline
Member
Posted 2 years ago #
Hmmm, I need to go the other way though... not knowing the $taxonomy of the post, and pulling it from the custom taxonomy that was set.
Like get_the_category() would do. Thanks though!
Justin Cline
Member
Posted 2 years ago #
I was able to figure it out with this post: http://wordpress.org/support/topic/295170?replies=24
Love the WP community, thanks guys
Frankie Jarrett
Member
Posted 2 years ago #
I think this may also be an easy solution for what you're looking for...
$current_tax = get_query_var('your_tax_slug');
echo $current_tax;
//Frankie
GabrielCol
Member
Posted 2 years ago #
To display the name of the taxonomy, no matter what taxonomy is:
$value = get_query_var($wp_query->query_vars['taxonomy']);
echo get_term_by('slug',$value,$wp_query->query_vars['taxonomy']);
Happy wordpressing ;)