한 페이지당 표시되는 상품 수를 변경하고자 할 때 (기본 12, 넘으면 페이지네이션 작동)
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 = 9;
return $cols;
}
한 열에 표시되는 컬럼 수를 조정하고자 할 때 (※ 테마에서 관련 함수를 등록됐을 때를 예로 듦)
// Change number or products per row to 3
add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
function loop_columns() {
return 3; // 3 products per row
}
}
쇼트코드를 통해 목록 표시할 때
[recent_products per_page="12" columns="5"]