Ismeritek az eljárást: hozzunk létre egy fájlt - mondjuk woocommerce-products-per-page.php
néven - az mu-plugins mappában, az alábbi tartlommal:

A shop oldalon megjelenített termékek számának megváltoztatása WooCommerce esetén
|
Olvasási idő:
1
perc
A WooCommerce a Shop oldalon annyi terméket jelenít meg, amennyit a Beállítások > Olvasás oldalon az "A megjelenő oldal mutasson legfeljebb" opcióban beállítunk. Ezzel a snippettel könnyen felülírhatjuk ezt a beállítást anélkül, hogy a globális beállítást meg kellene változtatnunk.
php
<?php
/*
Plugin Name: Change number of products on shop page
Plugin URI: https://docs.woocommerce.com/document/change-number-of-products-displayed-per-page/
Description: Change number of products that are displayed per page (shop page)
Version: 1.0
Author: Automattic
Author URI: https://docs.woocommerce.com/document/change-number-of-products-displayed-per-page/
License: GPLv3
*/
/**
* Change number of products that are displayed per page (shop page)
*/
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );
function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options -> Reading
// Return the number of products you wanna show per page.
$cols = 25;
return $cols;
}
A loop_shop_per_page
hookra rákapaszkodva felülírjuk a beállítást, és az itt hardcode-olt értéket adja vissza a függvény - de csak erre az egy oldalra.
Készen is vagyunk - that's all folks!