• Resolved wzshop

    (@wzshop)


    Hi,
    I have a simple question regarding the WordPress template hierarchy.
    I know WordPress has a template hierarchy which allows to automatically override the template to be used when loading a page. Now I would like to know if such a hierarchy also is being applied on the header.php file.
    I have a theme with a template file called ‘tpl-ads-home.php’ and ‘header-tpl-ads-home.php’. Does this ‘header-tpl-ads-home.php’ file has a higher priority than ‘header.php’ file (because of hierarchy) for pages that have the ‘tpl-ads-home.php’ template?

    Thanks

    • This topic was modified 4 years, 7 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 4 replies - 1 through 4 (of 4 total)
  • You’ll probably need to ask the provider of your template for help with this.

    My best guess would be that the modified header directives would superimpose over the standard header as the theme page asks for that (or not).

    That’s not really a hierarchy but would be more of a ‘require’ with a possible ‘if-then’ statement triggering that.

    By reading the raw template file you can sometimes figure that out. Sometimes it gets buried and/or obfuscated so much that you can’t tell. Especially when looking from the web server’s output by looking from the web browser.

    You can look by using CTRL-U in the web-browser and I encourage you to do so. That’s when a webpage often ‘gives up its secrets’.


    All real website intelligence is found in the raw headers. Some of my own are hilarious.

    Thread Starter wzshop

    (@wzshop)

    Hi,
    Thanks. I know a theme could require any header they want. I want to know though if this is a native WP hierarchy funtion.
    Thanks!

    The get_header() command can take a parameter to specify a different header. Example get_header() would get the file header.php get_header(‘foobar’) would get the header header-foobar.php. You probably have a template that uses the get_header() command to load a different header.

    • This reply was modified 4 years, 7 months ago by mrtom414.
    Thread Starter wzshop

    (@wzshop)

    Awesome, thanks for the clarification!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Header hierarchy in WordPress?’ is closed to new replies.