0

Issue: Creating a Custom Header and Footer in WordPress I’m currently working on a WordPress website and facing some challenges with creating a custom header and footer for specific pages. Here’s a summary of the problem:

Goal: I want to create custom headers and footers that are different from the site-wide default ones for certain pages. These headers and footers should only appear on selected pages, not across the entire site.the thing is that the page I want it to be shown is using a diffrent theme than the rest of the website , I want the custom header and footer to be shown on this page, I've been having an issue with the checkout page , so I used a plugin called 'Multiple Theme Plugin' with this plugin I managed to disable the default theme and then enable Twenty Three theme instead , and this page doesn't have any footer or header , so I want it now to have the same Header and Footer as the rest of the website , default Header and Footer.

Problem: After creating the custom headers and footers, I’m unable to apply them correctly to the desired pages. Instead, the default header and footer are still being displayed. I’ve tried various methods, such as:

Using theme builders (Elementor, WPBakery, etc.) Modifying the theme’s PHP files directly Adjusting settings through the Customizer Despite these efforts, the custom designs do not appear as expected, or they override the entire site instead of just the target pages. What I’ve Tried So Far:

Using page-specific templates. Implementing conditional logic in functions.php. Utilizing plugins like “Header Footer Code Manager” to inject code snippets. Result: None of the above methods seem to work consistently. Either the custom header and footer are not loading, or they replace the site-wide elements on every page.

I would greatly appreciate any advice on how to properly set up custom headers and footers for specific pages, ideally without affecting the rest of the site. If anyone has a similar experience or a recommended solution, I’d love to hear your suggestions!

3
  • 1
    Hard to answer without any code. How did you get your site to use two themes? Commented Oct 4 at 16:48
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Commented Oct 4 at 16:54
  • Hey @TonyDjukic Thanks for Replying to my issue , I have edited the description with more details , if you can check it and let me know if you need something else to help you understand the issue. Commented Oct 7 at 16:02

1 Answer 1

1

What you want to do is create separate page templates then in those page templates where you call the WP header, you would reference different headers.

By default your theme will have these: header.php page.php

In your page.php there's a line wp_header();

When you make your template, which can easily just be a copy of page.php with a few minor changes, you would then reference a different header file.

ie. wp_header( 'new' );

Then you have to have a file like header-new.php in your theme directory.

The same thing applies to footer.php and wp_footer();.

5
  • I have already tried this method, but unfortunately, it doesn't work in my case. I am disabling the default theme on the checkout page, and it’s using a different theme than the rest of the website. I also tried creating a child theme with a custom header and footer and calling it, but it still didn’t work. Commented Oct 7 at 16:12
  • How are you managing to get your site to use TWO themes? I've never seen a WP site using two different themes at the same time. Commented Oct 8 at 15:10
  • I used a plugin called 'Multiple Theme Plugin' with this plugin I managed to use two themes at the same time. Commented Oct 8 at 15:31
  • Yeah, that's an important detail and the issue could be, and most likely is, a compatibility issue or a deficiency in capability with that plugin. Is that plugin WooCommerce capable/compliant? Have you reached out to that plugin developer to see if what you're asking can be done with WooCommerce? Commented Oct 8 at 17:45
  • From the plugin's comments/support section "it’s not working with WordPress 6.4.1 please upgrade it ". Commented Oct 8 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.