How to limit page numbers shown in the pagination output?
-
I am using Underscores with Woocommerce boilerplate. I want to ask how to limit the page numbers shown, eg.:
If I have say 17 pages of products, it will output:
1 2 3 4 … 15 16 17
so 4 pages, followed up with dots, followed up with three more pages. Or if I have 9 pages, it shows up every page 1-9 so 1 2 3 4 5 6 7 8 9.
I want to limit this in both scenarios, for example always show 4-5 pages max. I am not sure how to implement this myself, due to my limited knowledge I just tried adding the following to my inc/woocommerce.php (I used 1’s just for example sake, and I :
apply_filters( ‘woocommerce_pagination_args’, array(
‘page_end_size’ => ‘1’,
‘page_mid_size’ => ‘1’,
‘use_dots’ => ‘1’,
));However, nothing changes, so I want to ask how to do this, I read that some plugins have this ability – but then why would this not be documentated anywhere? I got the code from a combinations of websites. I am pretty sure I am messing something up badly due to my lack of knowledge, like the usage of my filter. So please if it possible to fill me in I would appreciate it.
- The topic ‘How to limit page numbers shown in the pagination output?’ is closed to new replies.