Support » Fixing WordPress » Test if you are on a permalink page

  • Hello all,
    I am trying to tweak the layout of my home page. Is there a way to test if the current page is a permalink page, an archive or the home page?
    I tried everything and I’ve searched the forum for half a day. There must be something obvious that I am missing.
    Please help. TIA.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Mark (podz)

    (@podz)

    Support Maven

    Look at the address bar.
    An archive is a permalinked page, and a permalinked page will look like an archive, if that makes sense.

    Ugh… sorry about that.
    What I mean is: What kind of PHP test should I perform inside index.php in order to have different output for the permalink pages and the home/other pages.
    Something like
    if ($justArticle) {
    /* do article stuff */
    } else {
    /* do homepage or archive */
    }

    <?php
    if ($single) {
    /* blah blah blah */
    } else {
    /* blah blah blah */
    }
    ?>

    In 1.3-alpha, you can use is_single() instead of $single.

    TechGnome

    (@techgnome)

    Moderator

    You’ll have to forgive podz, he’s a little dense sometimes. ;P
    TG

    It worked, thanks codegurl! I knew it should be this easy 🙂
    NB: feeds for each topic is gold.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Test if you are on a permalink page’ is closed to new replies.