• I’m trying to figure out how to display the latest instance in each of 3 categories on the index page, am not getting answers to my questions here, and am slowly stumbling my way through the Codex, and now have a question about one of the examples.

    <?php if (is_category('11') ):
     // we're in the Plants category, so show a plant ?>
     <img src='/images/plant.png' alt='a plant' />
    <?php } elseif (is_category('22') ):
     // we're in the Flowers category, so show a flower ?>
     <img src='/images/flower.png' alt='a pretty flower' />
    <?php endif; // end the if, no images for other other categories ?>

    Line 4 has a closing curly bracket that prompts an error when I put the snippet in my index template.
    Why is the closing curly bracket there?
    What does it do?

    I took it out, the error goes away, I seem to have fixed a subsidiary problem, and might then be able to get back to my main question.

Viewing 4 replies - 1 through 4 (of 4 total)
  • well, I’m no php rockstar…

    but looking through my theme, none of my php lines have a bracket like that, so I’d assume it was errant

    Thread Starter nunovo

    (@nunovo)

    So I may have found an error in the Codex tutorial?

    I must be getting better at this…

    Yes that’s a typo, someone made a minor mistake..

    There are a few others scattered throughout the codex, but it’s like a Wiki in many ways, lots of people contribute, so mistakes will occur..

    Thread Starter nunovo

    (@nunovo)

    Wah-hey, first bit of debugging I’ve ever done!
    Well, insofar as it counts.
    Back to the original problem of the Loop and categories now…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘why is the closing curly bracket here?’ is closed to new replies.