Support » Fixing WordPress » wordpress not finding single.php ?

  • For a theme I am working on, wordpress is not finding the single.php file. This is abundantly clear as the index is quite altered, and all the single pages are reverting to index.php.

    Anyone have any guesses as to why it’s not finding my single.php, perhaps grave syntax errors that would cause it to revert to index.php? I do want to have to make my homepage a page with template for various reasons, but this is one workaround I have in mind…

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Without more information, we don’t know. If the single.php is there in the template directory, and you’re hitting a single post page (is_single() returns true), then it will use it. Simple as that, really.

    Let me try again since I doubt anyone wants to read my hundreds lines of rough code..

    I have a single.php file in the template directory.

    And it is returning index.php for the single page IE when I click on a “permalink”.

    (other template files such as page.php, archives.php, are working as indicated by the template hierarchy)

    Has anyone had this problem before?

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    1. Check the permissions of single.php. Make sure it has the same permissions as the theme’s index.php. If WordPress can’t access it, then that’s the same as if it’s not there.

    2. What is the value returned by is_single() on these problem pages? Try adding something to your index.php that looks like this:

    if (is_single()) echo "SINGLE PAGE DETECTED!";
    else echo "NOT A SINGLE PAGE!";

    This will let you know whether WordPress thinks you are requesting a single page or not. If it thinks you’re not, then you need to find out why not.

    3. What is your custom permalink setting? Some permalink settings won’t work because they are not specific enough.

    duh thank you! Great tip for figuring out the matter.

    As it turns out this is some permalink/.htaccess related issue, in case anyone has the problem in the future and doesn’t have any permission issues with their individual template files, or any typos in template files.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘wordpress not finding single.php ?’ is closed to new replies.