katwhocodes
katwhocodes

Reputation: 2268

How to add pagination for a page of wordpress

I use the following code to display product in single page:

[product_category category="CUSTOMIZE" per_page="9" columns="3" orderby="date" order="desc"]

However, when the product exceed 9, it's not direct to next page. How to add pagination to this code?

Thanks!

Upvotes: 0

Views: 2664

Answers (1)

The Humble Rat
The Humble Rat

Reputation: 4696

It looks like currently woocommerce plugin does not actually support pagination on a products page.

See here http://ideas.woothemes.com/forums/133476-woocommerce/suggestions/4146798-add-pagination-support-for-list-of-products-render

There seems to be two common work arounds.

A: In your wordpress settings. Change the max amount of posts visible on a page and therefore all products are shown, hence no more need for pagination. Alternatively of course you could also set your per_page attribute to some ridiculous number.

B: Download the plugin wp-navi. Activate it and configure it. Then add the following code to your functions.php in your theme folder.

remove_action('woocommerce_pagination', 'woocommerce_pagination', 10);
function woocommerce_pagination() {
wp_pagenavi();      
}
add_action( 'woocommerce_pagination', 'woocommerce_pagination', 10);

Unfortunately there seems to be no definitive answer for this at the moement.

Upvotes: 0

Related Questions