How to adjust the number of listings displayed with the pre_get_posts filter

Using the WordPress pre_get_posts filter you can create a simple function to adjust the number of listings that display and leave your blog reading settings at 5 with the following function.

Add the following function to your theme functions file or custom plugin.

function my_epl_modify_listing_quantity( $query ) {
	// Do nothing if in dashboard or not an archive page
	if ( is_admin() || ! $query->is_main_query() )
		return;

	// Do nothing if Easy Property Listings is not active
	if ( ! function_exists( 'epl_all_post_types' ) )
		return;

	// Modify the number of all EPL listing types displayed on archive page
	if ( is_epl_post_archive() || epl_is_search() ) {
		$query->set( 'posts_per_page' , 3 ); // Adjust the quantity
		return;
	}
}
add_action( 'pre_get_posts', 'my_epl_modify_listing_quantity' , 99  );