term_id ) ) {
$child_categories = get_terms(array(
'taxonomy' => 'product_cat',
'parent' => $current_category->term_id,
'hide_empty' => false,
));
}
if ( !empty($child_categories) ) {
// Только подкатегории, без товаров в этой категории
?>
term_id, 'thumbnail_id', true);
$image_url = wp_get_attachment_url($thumbnail_id);
$description = term_description($child_category->term_id, 'product_cat');
echo '
';
if($image_url) {
echo '';
echo '
';
echo '';
}
echo '
';
}
?>
';
echo '' . esc_html($child_category->name) . '';
if($description) {
echo '
';
echo '' . $description . '
'; } echo 'Перейти в раздел'; echo '
';
woocommerce_product_loop_start();
if (wc_get_loop_prop('total')) {
while (have_posts()) {
the_post();
wc_get_template_part('content', 'product');
}
}
woocommerce_product_loop_end();
echo '
';
echo '';
$current_per_page = isset($_GET['per_page']) ? sanitize_text_field($_GET['per_page']) : '12';
$current_label = ($current_per_page === 'all') ? 'Все' : intval($current_per_page);
$check_svg = '';
$per_page_options = array('12', '24', '48', 'all');
$per_page_labels = array('12' => '12', '24' => '24', '48' => '48', 'all' => 'Все');
echo '';
echo '
';
do_action('woocommerce_after_shop_loop');
} else {
do_action('woocommerce_no_products_found');
}
?>
Количество товаров на странице:
'; echo ''; echo '';
foreach ($per_page_options as $opt) {
$is_active = ($opt === $current_per_page) ? ' active' : '';
echo '';
}
echo '
';
echo '
';
// Счетчик товаров
echo '';
the_posts_pagination(array(
'prev_text' => '', // SVG для стрелки назад
'next_text' => '', // SVG для стрелки вперед
'before_page_number' => '',
'after_page_number' => '',
));
echo '
';
global $wp_query;
$total_products = $wp_query->found_posts;
echo '' . $wp_query->post_count . ' товаров из ' . $total_products . '
'; echo '