Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( ! function_exists( 'cpt_archives_settings' ) ) :
- add_action( 'pre_get_posts', 'themename_cpt_archives_settings' );
- // Pass the $query argument into the action.
- function themename_cpt_archives_settings( $query ) {
- // Define the context.
- // Not on dashboard pages when inside the main query only on cpt archives.
- if( ! is_admin() && $query->is_main_query() && is_post_type_archive( 'cpt_name_goes_here' ) ) {
- // remove infinite scroll inside this context
- remove_theme_support( 'infinite-scroll' );
- // set query vars for this context
- $query->set( 'posts_per_page', '-1' );
- }
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement