FIXED - How to have different Headers and Footers with my templates?

Im newish to pinegrow - owned for a while and Im now using it more. Im using starter theme for a site with static front page and need multiple headers (two) on for for front-page.php and one for the rest of the site.

As it is now index.php is set to the masterpage / wordpress site and I made a new header called header-front-page.php that I manually edited to work.

My issue is when I make changes to the pinegrow project and save export, I have to manually adjust front-page.php to call the new header.

How can I define a second header for it inside the pinegrow project so it does not have to be updated by hand each time I save-export the theme ?

Thanks

I’m having a similar issue. I have a small conditional statement to determine which of two headers to use, but I don’t know where to put the conditional. If I attach it to any page within Pinegrow it will export the page with the conditional after the ‘get_header()’ call that it includes by default.

I know this previous post was back in 2017, just wondering if you ever found a solution, or if anyone at Pinegrow might have an answer?

The method available in Pinegrow for using different headers and footers on your templates is based on the use of master pages.

We have documented it here: Using Different Headers and Footers with Master Pages in Pinegrow

If you have any questions or need further assistance, feel free to let us know. Happy designing!

2 Likes

This is great information, thank you.

Curious though, what would you do in a situation (like I’m in now) where you have a template (your WooCommerce’s single-product.php) that is shared by both WooCommerce (displaying single product pages, as usual) and an auction plugin for WooCommerce displaying single auction details but with auction functionality-- AND (here’s the kicker) you really need a separate header and footer for the auction pages.

Assigning the single-product.php a master theme in Pinegrow won’t cut it here. Seems like a condition that checks for the product type in order to determine which header and footer to use is the only way forward, and that works, but I’m not sure how to implement that code in Pinegrow before the header is added.

Suggestions?

I’m sorry @Jonny , I have no particular experience with this specific use case and I can’t think of a pretty solution right now.
What I can say with confidence is that there is no ready made solution through a helper in Pinegrow.
However, as usual, everything that is not included can be added through standard code, from the UI (conditionals, functions) or from a code editor …

Thanks for your input. I’m certainly ok with inserting standard custom code, and I have in many other cases. The problem is knowing where to insert my custom code because the header is always applied before any custom code I might write for any given template.

Right now, I’m going in the the template php file after Pinegrow exports it, and replacing the get_header() with a conditional that determines which header to get.

Is there any way, to your knowledge, of writing custom code within Pinegrow that would replace the automatic: <?php get_header(); ?> that get applied at export?

Thanks for your time.

Oh, just to be clear, I’m replacing the <?php get_header(); ?> with:

<?php
global $srg_product;
$srg_product = wc_get_product(get_the_ID());

if ($srg_product && $srg_product->get_type() === 'auction') {
    // Include your custom header
    get_header('auction-template');
} else {
    get_header(); // Use default header
}
?>

A quick and simple workaround, without getting into the coding details, is to create a PHP template according to your needs, either manually or using any other solution. Then, you can put or import the PHP file into your HTML project folder, ensuring that no modifications are made during subsequent exports.

While this approach means you won’t be able to take advantage of Pinegrow’s features for this specific file, it will solve the problem. Additionally, if the theme is well-designed, the structure of the template shouldn’t require frequent changes in the future.

As a note, when I encounter similar situations in a project, I keep track of specific details such as code snippets to add, files to move, and files to remove in a quick documentation file within my project folder. This way, even after weeks, months, or years, I’ll still know what to do if any changes are needed.

Let me know if you have any further questions or concerns.