How to Query a Custom Post Type on a Page and have it Paginate

Here’s the scenario. Say you have a page called, “I like music”. And on that page you want to show posts from your Custom Post Type, “Songs”. You want to show 5 posts with the ability to click “next page” to show 5 more posts. You can do a custom query easily enough, but you need to set the query to paged to get pagination to work. Here’s how to do it.

Put the query right before the loop.

All that’s left is to set your pagination. You can learn how to do that here.

Leave a Reply

Your email address will not be published. Required fields are marked *

45 − 36 =