Forums

why is the closing curly bracket here? (5 posts)

  1. nunovo
    Member
    Posted 2 years ago #

    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.

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    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

  3. nunovo
    Member
    Posted 2 years ago #

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

    I must be getting better at this...

  4. Mark / t31os
    Moderator
    Posted 2 years ago #

    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..

  5. nunovo
    Member
    Posted 2 years ago #

    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...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.