add_filter('gettext', 'wpp_change_product_label_translate');
add_filter('ngettext', 'wpp_change_product_label_translate');
function wpp_change_product_label_translate($translated) {
$translated = str_ireplace('Товары', 'Продукты', $translated);
$translated = str_ireplace('Товар', 'Продукт', $translated);
return $translated;
}
function bla_bla_bla_post_class($classes, $product)
{
$classes[] = 'col-12';
$classes[] = 'col-md-3';
$classes[] = 'col-sm-6';
return $classes;
}
add_filter('woocommerce_post_class', 'bla_bla_bla_post_class', 10, 2);
<?php
/**
* Template Name: Бла бла бла
*/
get_header();
$args = [
'post_type' => 'product',
'tax_query' => [
[
'taxonomy' => 'product_cat',
'field' => 'name',
'terms' => 'Tem Name',
],
],
'posts_per_page' => - 1,
];
global $wp_query;
$wp_query = new WP_Query( $args );
if ( $wp_query->have_posts() ) :
woocommerce_product_loop_start();
?>
<?php while ( $wp_query->have_posts() ) : $wp_query->the_post();
?>
<?php wc_get_template_part( 'content', 'product' ); ?>
<?php endwhile;
woocommerce_product_loop_end();
?>
<?php else : ?>
<div>Товаров не найдено</div>
<?php endif;
get_footer();
/**
* Изменение количества продуктов на странице
*
* @compatible WooCommerce 3.2.0 +
* @see https://github.com/woocommerce/woocommerce/blob/7701d4b57cb20dc89e25bb7bf2ff872d85f4c535/includes/class-wc-query.php#L412
*/
function loop_product_per_page( $per_page ) {
if ( ! empty( $_GET[ 'products-per-page' ] ) ) {
$per_page = (int) ( $_GET[ 'products-per-page' ] );
} else {
$per_page = 12;
}
return $per_page;
}
add_filter( 'loop_shop_per_page', 'loop_product_per_page', 9999 );