• Resolved InHouse

    (@inhouse)


    Is it possible to force a child theme to ignore a parent theme’s home page template? The child theme design calls for the home page to look/function exactly as the internal pages do so I need to skip the page-home.php template that the parent theme uses. I don’t know if Filter Hierarchy is on the right track or if that’s unrelated to my needs. Either way, I’m unclear if this is possible and how to accomplish it. Any help would be greatly appreciated. Thanks in advance!

Viewing 7 replies - 1 through 7 (of 7 total)
  • jack randall

    (@theotherlebowski)

    yep, but you’ll need to create a new template to do it. https://codex.www.ads-software.com/Theme_Development#Template_Files

    Thread Starter InHouse

    (@inhouse)

    Thanks @jack Randall for the reply. The link is rather generic template information which I’m already aware of. What exactly are you advising? Renaming the parent theme home template to something else? I’m not sure what would work for the parent theme while not triggering the child theme. Both sites use a static page for home, not posts.

    jack randall

    (@theotherlebowski)

    duplicate the parent theme’s page.php file, move the duplicate over to the child theme and rename it page-home.php

    in the page-home.php file change the heading stuff (in the /**…**/) to Template Name: Home Page Template

    it should now look like this:

    /**
    Template Name: Home Page Template
    **/

    now, in the dashboard create a new page called Home; in the page edit screen you can select the template to apply to the page so choose your new “Home Page Template” template and publish it (don’t worry about any content on this page at the moment.)

    go to settings -> reading and choose your new home page as your static front page and save.

    now you’ve got a totally independent template that you can customise to your needs that is only accessed from the child theme.

    Thread Starter InHouse

    (@inhouse)

    This method is a very manual approach. I already knew I could simply duplicate the child theme page.php template as the child page-home.php template but updates to the main page template would require updating he home template. My main goal was to discover a method to disable the parent page-home.php template for the child theme. Thanks again

    jack randall

    (@theotherlebowski)

    then name the file in the child theme something else, page-home-new.php and then when page-home.php updates your page-home-new.php file won’t be overwritten.

    Thread Starter InHouse

    (@inhouse)

    When you rename the child theme template file, it doesn’t get used at all and the parent home template is still used. The filename must be page-home.php for it to be used. My goal is to not use a home template at all in the child theme and to let the child page.php control the home page. I’m not seeing any to accomplish this without some function in the child theme. If you look at Filter Hierarchy it sounds as though there might be a way but I’m not understanding how it works. Do these filters change the hierarchy so page.php is higher priority than page-home.php?

    Thread Starter InHouse

    (@inhouse)

    Ah I was mistaken actually. The parent theme home template is not actually being used after all but the parent theme CSS made me think it was. What a stupid mistake. Turns out the child theme page.php template is being used as desired. Wish I could delete the thread as it won’t help anyone. Sorry!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Force Child Theme to Ignore Parent Theme Home Page Template’ is closed to new replies.