Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress Ignores the index.php & uses the page.php instead

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27062
    fs_tigre
    Member

    Hi,

    I’m currently learning to create themes in WP but I’m a little confused. I created my HTML/CSS page and then I started converting it into a WP theme using an empty theme from starkers which contains a lot of pre-made themes like page.php, archives.php, comments.php etc, but I noticed that WP was ignoring the index.php template which should contain the main content and that was driving me crazy so I decided to start from scratch and then I started deleting all templates except the four basic ones (header.php, index.php, sidebar.php and footer.php) and as soon as I deleted them my theme worked just as it should, then I put all the templates back into the theme’s folder and again the page wasn’t behaving as it should, so I started deleting the extra templates one by one to find the one causing the problem and I found that the one causing the problem was the page.php, I deleted only this template and the theme now works just fine. It looks like it was showing the page.php instead of the index.php which doesn’t have a sidebar. The problem is now solved but I would like to know how this happen because now I won’t be able to use the page.php if I would need to. May be I changed the settings in the Admin area to use a different template? If yes, where is this option?

    Any idea why or what was causing the problem?

    Thanks

    #67484
    AshtonSanders
    Participant

    Well, what is actually happening is that the themeing system is working just like it should.

    Quick WP theme explanation:

    index.php is the LAST RESORT for any page/post/category, etc. If you go to the "Cool" category page (that has the id of 6), the theme will look for themes in this order:

    category-cool.php
    category-6.php
    category.php
    archive.php
    index.php

    It will go down this list until it finds a template, and then it will use that template.

    More detailed information: WordPress Hierarchy

    #71864
    fs_tigre
    Member

    Thanks a lot! For your reply.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.