Ok, so I have tried about 5 different WP functions now and no luck. Basically here is what I want to do. I have a custom post type called "work", I have a taxonomy within this custom post type called "type" with 2 types available.. "Case Study" & "Portfolio". Depending on which option is checked off I would like that to print in the class of my container for that item and also be converted to lower case with spaces replaced by underscores.
<aside class="work_item <?php has_term('Portfolio', 'type'); ?>" data-type="<?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo str_replace('-','_',$tag->slug . ' '); } } ?>">
That is what I have now but no luck.. I have tried:
has_term get_the_terms get_term
and no luck... been looking at this so long now feel like I am missing something dumb
Desired output:
<aside class="work_item case_study" data-type="<?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo str_replace('-','_',$tag->slug . ' '); } } ?>">
&
<aside class="work_item portfolio" data-type="<?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo str_replace('-','_',$tag->slug . ' '); } } ?>">
Thanks!