Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set posts per page limits for each of Event Espresso custom post types
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
if ( !is_admin() ){
add_filter( 'pre_get_posts', 'ee_custom_posts_per_page' );
}
function ee_custom_posts_per_page($query) {
if ( is_post_type_archive() ) {
switch ( $query->query_vars['post_type'] ) {
case 'espresso_events': // Event Espresso event post type
$query->query_vars['posts_per_page'] = 30;
break;
case 'espresso_venues': // Event Espresso venue post type
$query->query_vars['posts_per_page'] = 15;
break;
case 'espresso_people': // Event Espresso people post type
$query->query_vars['posts_per_page'] = 90;
break;
default:
break;
}
}
return $query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.