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.

 'songs',   // Custom Post Type
    'paged' => $paged,       // Set it up to be paged so you can use pagination
    'posts_per_page' => 5    // How many to show per page
) );  
?>





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