Skip to content

Instantly share code, notes, and snippets.

@kmaroff
Last active August 11, 2021 11:04
Show Gist options
  • Select an option

  • Save kmaroff/a0505c2d7419e208dcb8a3b744175357 to your computer and use it in GitHub Desktop.

Select an option

Save kmaroff/a0505c2d7419e208dcb8a3b744175357 to your computer and use it in GitHub Desktop.
add_action( 'pre_get_posts', 'custom_pagesize');
function custom_pagesize( $query ) {
if( is_admin() || ! $query->is_main_query() )
return;
if ( is_post_type_archive('portfolio_pods') ) {
$query->set( 'posts_per_page', 9999 );
return;
}
if ( is_post_type_archive('news-pods') ) {
$query->set( 'posts_per_page', 12 );
$query->set( 'orderby', 'ID' );
$query->set( 'order', 'DESC' );
return;
}
if ( taxonomy_exists('specialists_cat') ) {
$query->set( 'posts_per_page', 9999 );
$query->set( 'orderby', 'ID' );
$query->set( 'order', 'ASC' );
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment