5 things you should know about WordPress HEADER and FOOTER in Pinegrow
Header and Footer are two important parts in a WordPress theme and thanks to Pinegrow, you can easily handle both of these elements.
For a better understanding of the following informations, we assume that you have already viewed our online course about creating a WordPress themes and read the most of our other articles.
If you work on your theme’s master page, the process of defining a Header and a Footer is straightforward:
You define the main section of your template by adding the Site Content action and everything that is on top of the section will be the HEADER (header.php when exported) and everything that is below the section will be the FOOTER (footer.php when exported).
In that situation, if you need to edit header or footer, you just change the relevant part of your page and you’re done.
But a theme is rarely just a single index page and as soon as you start creating other templates (single.html, page.html …) you can end up in a bit of confusion when modifications of header and footer are needed …
5 things you should know …
- While site content action can be used in any template to define the main content of the document, the HEADER and the FOOTER can ONLY be modified from the master page. (In fact, you can modify these elements in any template other than the master page but the changes will not be applied to the theme during the export).
- When site content action is applied on the main content of any of your template other than master page, using Apply master page (WordPress > Apply master page) will import the header and footer from the master page to your current template and will replace any elements located at the corresponding positions. While it can be considered as a “cosmetic action”, It is very helpful to keep all your HTML templates conform to the final result.
- You cannot set different headers and footers per template. If you really want to set a specific header and footer in a template, you can decide not to use the site content action on you main content. Then your template will not use the global header/footer templates anymore. (This is a temporary workaround and we plan to provide better solutions in a near future)
- It is recommended to set the master page for any template that you create in your theme (WordPress site > Use master page)
- During the design step, it can be very useful to use the HEADER, FOOTER and MAIN HTML5 tags to enclose the corresponding sections in your HTML template.
Discover our video about WordPress theme structure!