Support » Themes and Templates » home.php template not called when on home

  • so here is my setup. Setting a specific Page to be used on the frontpage via Options -> Reading ->Front Page.

    I have created a theme with the index.php for interior page views as well as a home.php for the home view. This is no different than any of the other themes I’ve setup for client. Per the template heirarchy the home.php template will be used if present and the user is at the site home.

    When I surf to the site root I’m served the index.php instead.

Viewing 5 replies - 1 through 5 (of 5 total)
  • – home.php was a method used before that option in Reading has been created
    – seemingly the two methods will NOT work together

    Well according to the page heirarchy home.php is still used if present. I’ve tested this. If I don’t set an option on the Reading section then the home.php is used.

    My problem is I *need* to set the home page (/) to have certain page content. So my assumption was using the Reading options would provide the solution.

    I had this same problem. As per Creating your own Page Templates I decided to try giving home.php a name like this:

    Template Name: Home Template

    Then I just set that to be the Page Template for my specific Page using the options on the right side of the Write Page screen.

    Note, it appears that the ‘Page Template’ option does not show up on the Write Page screen unless you have created some named templates.

    Hope that helps.

    I decided to try giving home.php a name like this:
    Wrong! home.php is NOT a Page template’
    It is a template file in the Template_Hierarchy

    As I said above: you either go with the home.php technique or you use the set a Page as you homepage feature introduced in the latest WP versions. Do NOt mix and mess the two.

    Moshu, the issue as I understand it from the original poster and from my own experience is that when WP is set to use a Static Page as the front page, the home.php template method simply does not work.

    I could also have created a totally new file, say home_template.php, made it into a template in exactly the same way, and applied that to my designated Static Page. Which is actually what I did initially.

    But rather than having a home_template.php and a home.php file, I tried applying the template name to the home.php file directly.

    And, it worked. It’s doing the job I need it to do without any extraneous files.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘home.php template not called when on home’ is closed to new replies.