I’m running this inside a loop in WordPress:
<?php
if ( term_exists('term'=> 'pdf'))
{
echo 'PDF' ;
}
else if ( term_exists('term'=> 'ppt'))
{
echo 'PPT' ;
}
else ( term_exists('term'=> 'mov'))
{
echo 'MOV' ;
}
?>
I’ve created a taxonomy called file-formats and these terms above ( pdf, mov, ppt ) are in my file-formats taxonomy.
And I’m trying to echo specific stuff, depending in which term the post is in.
But the PHP script above just seems to brake the site. Can anyone help?
UPDATE
This still not working…
<?php
if (term_exists( 'term' => 'pdf' )) {
echo 'PDF' ;
}
else if (term_exists( 'term' => 'ppt' )) {
echo 'PPT' ;
}
else if (term_exists( 'term' => 'mov' )) {
echo 'MOV' ;
}
else {
echo '' ;
}
?>
Check your
elsepart. Should be:Reference: term_exists($term, $taxonomy)