Support » Fixing WordPress » taxonomy problem

  • Hi guys.. please help..

    I would like to detect which category of taxonomy the post is.. then it will display some text..

    here’s the code that i made

    <?php if (has_term( ‘green’, ‘color’ )) { ?>
    <p>Green</p>
    <?php } elseif(has_term( ‘blue’, ‘color’ )){ ?>
    <p>Blue</p>
    <?php } elseif(has_term( ‘red’, ‘color’ )){ ?>
    <p>Red</p>
    <?php } elseif(has_term( ‘yellow’, ‘color’ )){ ?>
    <p>Yellow</p>
    <?php } else{ ?>
    ….
    <?php }
    ?>

  • The topic ‘taxonomy problem’ is closed to new replies.