Support » Themes and Templates » show different content on category and home

  • Resolved visiblemedia

    (@visiblemedia)


    I found this code:

    <?php if (is_category(‘baseball’)) { ?>
    baseball
    <?php } elseif (is_category(‘football’)) { ?>
    football
    <?php } elseif (is_category(‘hockey’)) { ?>
    hockey
    <?php } elseif (is_category(‘basketball’)) { ?>
    basketball
    <?php } else { ?>
    every other category
    <?php } ?>

    which works GREAT! except I want to also have a piece of code (a banner ad actualy) show only on the home page, as well as the ones targeted to specific categorys, and the one not targeted to any category. Does anyone know how to do this?

    I tried this:

    <?php if (is_home()) { ?>
    home
    <?php elseif (is_category(‘baseball’)) { ?>
    baseball
    <?php } elseif (is_category(‘football’)) { ?>
    football
    <?php } elseif (is_category(‘hockey’)) { ?>
    hockey
    <?php } elseif (is_category(‘basketball’)) { ?>
    basketball
    <?php } else { ?>
    every other category
    <?php } ?>

    Which seems like it should work, but it doesnt… what did I do wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘show different content on category and home’ is closed to new replies.