WordPress has an option to allow you to choose number of post to be displayed in your site. This option can be seen from Writing settings page.
The number you set here is the number of post that will be displayed on all archive pages, including the archive page for Custom Post Type (CPT). However, there’s a way to overwrite this number of post to be displayed on your CPT archive page.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
This code should go into functions.php
file of your child theme. The code is self-explanatory. We use pre_get_posts
filter to overwrite the number of post in portfolio post type. Simply replace 'portfolio'
with the name of your CPT.
If you’re new to CPT, here are some great tutorials we’ve published about CPT:
Leave a Reply