Answer the question
In order to leave comments, you need to log in
How to create a condition for issuing goods from several categories?
There is a filter on the site in which you can choose to filter products by several categories, while we get this kind of link:
/cat/mens-home-suits,underclothers,chemise-and-tunics/
There is also a code responsible for displaying an additional header in categories :
// Изображение категории на странице рубрики
add_action( 'woocommerce_archive_description', 'woocommerce_category_image', 0 );
function woocommerce_category_image() {
if ( is_product_category() ){
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id );
if ( $image ) {
echo '<div class="archive-header" style="background: url(' . $image . ') no-repeat 50%; background-size: cover;">';
echo '<div class="archive-title"><h1 class="page-title">';
woocommerce_page_title();
echo '</h1></div>';
}
else {
echo '<div class="archive-header">';
echo '<h1 class="woocommerce-products-header__title page-title">';
woocommerce_page_title();
echo '</h1></div>';
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question