mikelittle

Increase archive length for category

Apr 21st, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. add_action( 'pre_get_posts', 'zed1_increase_archive_length' );
  2. function zed1_increase_archive_length( $query ) {
  3.  
  4.     // if this is not the main query on the page, do nothing
  5.     if ( !$query->is_main_query() )
  6.         return;
  7.  
  8.     // if this is our category increase number of posts
  9.     if ( $query->is_category( 'podcast' ) ) {
  10.         $query->set( 'posts_per_page', 999 );
  11.     }
  12. } // end zed1_increase_archive_length
Advertisement
Add Comment
Please, Sign In to add comment