Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • volcaremos

    (@volcaremos)

    The non-PHP expert has worked it out by himself, the category requires at least one post to work ( I presume it is the same for pages ) for reference here is the code:

    \
    <?php if (in_category(‘2’) ): ?>
    <img src=”path/image2.jpg” alt=’Category Name’ />
    <?php elseif (in_category(‘3’) ): ?>
    <img src=”path/image3.jpg” alt=’Category Name’ />
    <?php elseif (in_category(‘4’) ): ?>
    <img src=”path/image4.jpg” alt=’Category Name’ />
    <?php else : ?>
    <img src=”path/otherimage.jpg” />
    <?php endif; ?>
    \

    volcaremos

    (@volcaremos)

    The Code above submitted by Kafkaesqui seems to have missing brackets. Couls someone please supply corrections? I tried to adapt this script to work with different categories but even by adding extra brackets and removing error message only the first category display a banner image. Is the final else required for code to work?

    Thank you (non-PHP expert)

Viewing 2 replies - 1 through 2 (of 2 total)