Advertisement
Guest User

Untitled

a guest
May 26th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. if ( ! function_exists( 'cpt_archives_settings' ) ) :
  2.  
  3. add_action( 'pre_get_posts', 'themename_cpt_archives_settings' );
  4.  
  5. // Pass the $query argument into the action.
  6. function themename_cpt_archives_settings( $query ) {
  7.  
  8. // Define the context.
  9. // Not on dashboard pages when inside the main query only on cpt archives.
  10. if( ! is_admin() && $query->is_main_query() && is_post_type_archive( 'cpt_name_goes_here' ) ) {
  11.  
  12. // remove infinite scroll inside this context
  13. remove_theme_support( 'infinite-scroll' );
  14.  
  15. // set query vars for this context
  16. $query->set( 'posts_per_page', '-1' );
  17.  
  18. }
  19.  
  20. }
  21. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement