I'm struggling to get this to work.
Basically, I'm running a WP query to retrieve multiple posts from my custom post-type.
In the loop, I want to conditionally echo stuff, depending on what term is assigned to that post.
I've created a taxonomy called 'file-types' and have assigned this to my custom post type.
As I understand terms, terms are like the children of taxonomy. "Not literally"
My problem, my PHP below just seems to echo the last condition, which is nothing.
And I've 100% assigned these terms to my posts.
The only thing I have not tried is changing 'term_taxonomy' to a 'term_taxonomy_id' - but I cannot for the life of me find out how to find the ID of my taxonomy.
Can any one help me understand why nothing is being echo'ed? Many Thanks
<?php
if (term_exists(array(
'term_id' => 4,
'term_taxonomy' => 'file-formats'
))) {
echo 'PDF' ;
}
else if (term_exists(array(
'term_id' => 6,
'term_taxonomy' => 'file-formats'
))) {
echo 'PPT' ;
}
else if (term_exists(array(
'term_id' => 5,
'term_taxonomy' => 'file-formats'
))) {
echo 'MOV' ;
}
else {
echo '' ;
}
?>