I am currently attempting to create a website that shows two different headers depending on the category of a product.
I was thinking of using an if statement, but cannot get it to work. This is my code:
<head>
<?php get_header(); ?>
<?php get_product_category()?>
<?php if ( is_product_category ('miele')){
get_template_part( 'template-parts/template-part' , 'miele-head' );
}
else{
get_template_part( 'template-parts/template-part' , 'head');
}
?>
</head>
<body>
<!-- start content container -->
<div class="row rsrc-content">
<?php //left sidebar ?>
<?php get_sidebar( 'left' ); ?>
<div class="col-md-<?php alpha_store_main_content_width(); ?> rsrc-main">
<div class="woocommerce">
<?php if ( get_theme_mod( 'woo-breadcrumbs', 0 ) != 0 ) : ?>
<?php woocommerce_breadcrumb(); ?>
<?php endif; ?>
<?php woocommerce_content(); ?>
</div>
</div><!-- /#content -->
<?php //get the right sidebar ?>
<?php get_sidebar( 'right' ); ?>
</div>
<!-- end content container -->
<?php get_footer(); ?>
The product category I am trying to utilise is called miele, and there are two header template files, called 'head' and 'miele-head'
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire