• Hi,
    I’ve learned so much and solved a lot of problems from this forum, and now I got a problem taking me half a day but still got no answer.

    There are two parts A and B in my header.php, and I have a custom post type named new_categories in my functions.php file.

    The posts in new_categories will load part A, otherwise it loads part B.
    Here is the codes I tried, but it always loads A, is there anything I make mistake?

    <?php if ( $taxonomy_exists = taxonomy_exists(‘new_categories’) ):?>
    <div> A </div>
    <?php else:?>
    <div> B </div>
    <?php endif;?>

    Thank you for helping a wordpress beginner XD

Viewing 1 replies (of 1 total)
  • You might try this…please note that this is untested.

    <?php
    $taxonomy_exist = taxonomy_exists(‘category’);
    if ( $taxonomy_exists == true){
    echo “<div> A </div>”;
    } else {
    echo “<div> B </div>”;
    }
    ?>

    Good luck with your project.

    AJ

Viewing 1 replies (of 1 total)
  • The topic ‘How to display different parts of codes by using taxonomy?’ is closed to new replies.