Woocommerce category page missing paging

2019-06-13 17:16发布

For some reason the pagination is missing from the product category pages. It works fine on all other pages and just missing on the product category page.

I have extended the pagination template and its called properly on the shop page but not on the category page for some reason.

Can any one suggest why this is happening?

Also I have around 32 products on this page which should be enough to break records on to pages.

Thanks in advance.

1条回答
兄弟一词,经得起流年.
2楼-- · 2019-06-13 17:45

The problem was caused because the post_per_page query argument wasn't set on the archive page.

This can be solved by overriding and adding following code to your woocommerce archive (archive-product.php) page.

//Will only effect the woocommerce archive page
global $query_string;
query_posts($query_string . "&posts_per_page=12");

Or by adding following to the functions.php of your theme

 //Will effect both the woocommerce archive page and the wordpress archive page
function set_row_count_archive($query){
    if ($query->is_archive) {
            $query->set('posts_per_page', 15);
   }
    return $query;
}

add_filter('pre_get_posts', 'set_row_count_archive');

Hope this helps someone.

查看更多
登录 后发表回答