WordPress.org

Ready to get started?Download WordPress

Forums

is_single not working in index.php (2 posts)

  1. geniosity
    Member
    Posted 6 years ago #

    Hi,

    I've had this before and it just went away, so I can't tell you what I did. BUT:

    If I have a conditional statement using "is_single()" in my index.php, it doesn't work. Moving it to any other template page (like sidebar.php, for example) works fine.

    Also, using something like "is_home()" or "is_category()" works fine.

    Any guidance as to what I can look for. I'd have to assume it's something in the template, and probably something to do with the loop or a "$post change"...

    thanks.

  2. geniosity
    Member
    Posted 6 years ago #

    JUST in case anybody lands on this page because they did a similar "silly thing", the reason is_single() wasn't working is because I had a template page single.php. This meant that for any single posts, that template would be used, which obviously I hadn't noticed or thought about noticing.

    Anyway, just thought I'd let the other victims of PEBKAC know :-)

Topic Closed

This topic has been closed to new replies.

About this Topic