WordPress.org

Support

Support » How-To and Troubleshooting » is_single not working in index.php

is_single not working in index.php

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

Viewing 1 replies (of 1 total)
  • 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 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘is_single not working in index.php’ is closed to new replies.