Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this questionI've been trying to solve this for ages now.
I finally resorted to asking.
I am using a theme and I have created a child theme.
Everything is working fine, except the that one page uses a completely different header than the rest.
I can't seem to find a way so it uses the same header as the rest of the pages.
Can I enable a template layout on page attributes by any chance?
Thanks in advance,
Joey
Closed. This question needs details or clarity. It is not currently accepting answers.Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this questionI've been trying to solve this for ages now.
I finally resorted to asking.
I am using a theme and I have created a child theme.
Everything is working fine, except the that one page uses a completely different header than the rest.
I can't seem to find a way so it uses the same header as the rest of the pages.
Can I enable a template layout on page attributes by any chance?
Thanks in advance,
Joey
Share Improve this question edited Jan 13, 2021 at 9:36 Tony Djukic 2,2774 gold badges18 silver badges34 bronze badges asked Jan 12, 2021 at 22:45 joeyjoey 1 1- 1 Technically WooCommerce questions are off topic, so let's tackle this from a WordPress standpoint. Your theme has a template file that uses a different header than the other template files. You've got a child theme so you can override this effect. I'll try to post an answer with the solution shortly. – Tony Djukic Commented Jan 13, 2021 at 0:38
1 Answer
Reset to default 1Joey,
When you have a child theme you have the ability to take specific templates from the parent theme, copy the file into your child theme and then make edits. The template file in your child theme will override what the one in the parent theme is doing.
Using WooCommerce as an example, if we look into your parent theme you'll want to find a file called archive-product.php
. That's the default name unless your parent theme has named it something else. So you'd look for that file.
In that file you can actually see a note:
/**
* The Template for displaying product archives, including the main shop page which is a post type archive
*
* This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
So what you want to do is take that file from the parent theme, copy it into your child theme but make sure the file structure is the same. So if your theme has:
theme-folder/templates/woocommerce/archive-product.php
You'll want to copy it to:
childtheme-folder/templates/woocommerce/archive-product.php
Once you have the file in there, you open it up and you look for the following bit of code:
get_header( 'shop' );
Now, your first effort would be to change this to:
get_header();
See if that has the desired effect you want.
One thing to keep in mind is that IF there's an update to a plugin, like WooCommerce for example, or an update to the parent theme, you'll want to check the changelog to see if any of the changes apply to that specific template. If they do, copy the whole thing over and make the change again. As this is a relatively easy and straightforward change it shouldn't be too big a deal to just copy the whole thing and change the get_header()
line.
Hope you get it all working.