All Posts by Email, Once a Week

Media Temple logo

CSS-Tricks is brought to you in part by Media Temple, the web hosting that we both use and recommend.

[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:

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

    And this in the page:

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

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

    # April 14, 2010 at 9:36 am
    < ?php if (is_page()) { ...stufff...
    # April 14, 2010 at 10:28 am

    This reply has been reported for inappropriate content.

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



    Thanks a lot Chris.

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

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed