Grow your CSS skills. Land your dream job.

[Solved] WordPress: if page = single

  • # April 13, 2010 at 11:15 am

    I’m using wordpress. I want to add certain code to the header when someone is browsing an article page (which uses the page.php template). I’ve done something similar (not in wordpress) before by having this in the header:

    Code:
    < ?php if ($current_page == "gallery") { ?>

    < ?php } ?>

    And this in the page:

    Code:
    < ?php $current_page = "gallery"; ?>

    I’ve tried that but it’s not working in wordpress. Any ideas?

    # April 14, 2010 at 9:36 am
    Code:
    < ?php if (is_page()) {

    ...stufff...

    # April 14, 2010 at 10:28 am

    You forgot to close off the top line with ?>
    Here it is for anyone else who wants to know:

    Code:
    < ?php if (is_single()) { ?>

    …stufff…

    < ?php } ?>

    Thanks a lot Chris.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".