Добавьте следующий код в ваши functions.php:
function storefront_best_selling_products( $args ) {
if ( storefront_is_woocommerce_activated() ) {
$args = apply_filters( ‘storefront_best_selling_products_args’, array(
‘limit’ => 5,
‘columns’ => 5,
‘title’ => esc_attr__( ‘Best Sellers’, ‘storefront’ ),
) );
echo ‘<section class=”storefront-product-section storefront-best-selling-products” aria-label=”Best Selling Products”>’;
do_action( ‘storefront_homepage_before_best_selling_products’ );
do_action( ‘storefront_homepage_after_best_selling_products_title’ );
echo storefront_do_shortcode( ‘best_selling_products’, array(
‘per_page’ => intval( $args[‘limit’] ),
‘columns’ => intval( $args[‘columns’] ),
) );
do_action( ‘storefront_homepage_after_best_selling_products’ );
echo ‘</section>’;
}
}
Сокращенный
add_shortcode( ‘best_sellers’, ‘storefront_best_selling_products’ );
используйте шорткод "best_sellers", как этот
do_shortcode('[best_sellers]');
Надеюсь, это работает для вас.