admin管理员组文章数量:1122832
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!
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!
Share Improve this question edited Oct 7, 2024 at 16:00 Fayrouz Sihi asked Oct 4, 2024 at 16:42 Fayrouz SihiFayrouz Sihi 11 bronze badge 3- 1 Hard to answer without any code. How did you get your site to use two themes? – Tony Djukic Commented Oct 4, 2024 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, 2024 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. – Fayrouz Sihi Commented Oct 7, 2024 at 16:02
1 Answer
Reset to default 1What 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();
.
版权声明:本文标题:plugins - Create custom Header and Footer for a page that uses diffrent theme then the rest of the website 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736284084a1927174.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论