Advertisement
srikat

Untitled

Feb 23rd, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. add_action( 'pre_get_posts', 'be_change_home_posts_per_page' );
  2. /**
  3. * Change Posts Per Page for Posts page
  4. *
  5. * @author Bill Erickson
  6. * @link http://www.billerickson.net/customize-the-wordpress-query/
  7. * @param object $query data
  8. *
  9. */
  10. function be_change_home_posts_per_page( $query ) {
  11.  
  12. if( $query->is_main_query() && !is_admin() && is_home() ) {
  13. $query->set( 'posts_per_page', '3' );
  14. $query->set( 'no_found_rows', true );
  15. }
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement