Advertisement
Guest User

Untitled

a guest
Oct 24th, 2011
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. function wpse31701_filter_query() {
  2. global $wp_query;
  3. // Check year and month
  4. $wp_query->set('orderby', 'date'); $wp_query->set('order', 'ASC');
  5. if ( $wp_query->get( 'year' ) == 2005 and $wp_query->get( 'monthnum' ) == 4 )
  6. // Check page number to apply offset
  7. if ( $wp_query->get( 'paged') == 2 ) $wp_query->set( 'offset', 1 );
  8. else
  9. if ( $wp_query->get( 'paged') == 3 ) $wp_query->set( 'offset', 4 );
  10. else
  11. $wp_query->set( 'posts_per_page', 1);
  12. }
  13. add_action( 'pre_get_posts', 'wpse31701_filter_query' );
  14.  
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement