This tutorial shows how to set amount of custom posts in WordPress. Usually you should be able to set the amount of displayed posts in WordPress administration panel in Appearance > Reading section.
If the "Blog pages show at most" option doesn’t affect your posts please do the following:
1. Access your WordPress installation directory
2. Go to wp-content/themes/theme### folder
3. Open functions.php file
At the beginning of the document after the opening <?php tag add the following:
function iti_custom_posts_per_page($query)
{
switch ( $query->query_vars['post_type'] )
{
case 'your_custom_post_type_name': // Post Type named 'your_custom_post_type_name'
$query->query_vars['posts_per_page'] = X;
break;
default:
break;
}
return $query;
}
if( !is_admin() )
{
add_filter( 'pre_get_posts', 'iti_custom_posts_per_page' );
}
Where replace ‘your_custom_post_type_name’ with your custom post type name. And replace X for the variable $query->query_vars['posts_per_page'] with the amount of posts you want to display. For example:
$query->query_vars['posts_per_page'] = 20;
