WordPress.org

Ready to get started?Download WordPress

Forums

wordpress not finding single.php ? (5 posts)

  1. shownomercy
    Member
    Posted 6 years ago #

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

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  3. shownomercy
    Member
    Posted 6 years ago #

    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?

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  5. shownomercy
    Member
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic