Support » Themes and Templates » index.php vs home.php How to access both?

  • If I specify and home.php file in my theme directory, according to the template heirarchy it is displayed in preference of index.php

    My question is how do I access also index.php? Can it be done by passing a query in the URL?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • It is the index.php that is being called which in turn calls the home.php if it is available. index.php is always the first one to be accessed.

    From the support docs:

    “For example, if your blog is at http://example.com/wordpress/ and a visitor loads the page http://example.com/wordpress/, WordPress looks for a template file called home.php and uses it to generate the requested page. If home.php is missing, WordPress looks for a file called index.php in the active theme’s directory, and uses that template to generate the page.”

    So Ok thanks for your input, but how do I call one or the other if WP always displays the top template in the heirarchy by default. I’m asking how to access the next template down in the heirarchy when both are present.

    Cheers.

    Bump

    home.php is only displayed on the front page. It is not used anywhere else. That is, home.php is not used on archive pages, single post pages etc…

    Hence the question is a bit of a misnomer as if you don’t want home.php to be used, then the answer is not to use a home.php file.

    Remember, there’s a different hierachy for the various given sections i.e. page.php takes precedance on Pages. Index.php is the general catch-all case. It’s used if there isn’t a template of higher priority.

    Thanks ifelse. I guess it’s the template loader script that’s foxing me rather than the files themselves.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘index.php vs home.php How to access both?’ is closed to new replies.