Hi @mpdesigner11,
Could you perhaps give us an outline with some more detail on what you are wanting to change in a header per product? Is this just an image or text or more? 🙂
Thanks for giving us more clarity to figure out what’s possible here.
Hi ryanr14,
Thanks for the response! At this point it’s just a logo change. My client has two separate product categories and they’d like to brand them differently. I was able to create a separate header for one of the brands and reference it (header-project.php) and have created another header (header-company.php), but just need some guidance on how and where to put the conditional statement based on product type?
Cheers,
mp 🙂
@mpdesigner11 In the example you gave, the has_term check is where you would put the slug of the product category you’d like to display the custom header for. Then in the get_header function, you would put either project or company to query the proper header.
Thanks @jessepearson – appreciate the feedback!
Just a quick follow up, where would I put that code? Function.php? Single-Product?
Cheers,
mp
@mpdesigner11 It would go in functions.php .
Fantastic, thank you @jessepearson
SOLUTION:
This function wasn’t working in Functions.php – because of the theme’s custom Single-Product.php implementation.
I replaced get_header ( ‘shop’ ) in single-product.php with:
if ( is_product() ) {
if ( has_term( ‘bracelets’, ‘product_cat’ ) ) {
get_header(‘project’);
} elseif ( has_term( ‘jewelry’, ‘product_cat’ ) ) {
get_header(‘project’);
} elseif ( has_term( ‘cards’, ‘product_cat’ ) ) {
get_header(‘company’);
} elseif ( has_term( ‘t-shirts’, ‘product_cat’ ) ) {
get_header(‘company’);
}
}