• Skip to primary navigation
  • Skip to main content

Genesis Community

Resources for Genesis WordPress Theme Users

  • Facebook
  • Twitter
  • Slack
  • Wiki
  • Login
You are here: Home / Wikis / WordPress / Change Posts Per Page for Event Archive

Change Posts Per Page for Event Archive

add_action( 'pre_get_posts', 'be_change_event_posts_per_page' );
/**
 * Change Posts Per Page for Event Archive.
 *
 * @author Bill Erickson
 * @link http://www.billerickson.net/customize-the-wordpress-query/
 * @param object $query data.
 *
 */
function be_change_event_posts_per_page( $query ) {

    if ( $query->is_main_query() && ! is_admin() && is_post_type_archive( 'event' ) ) {
        $query->set( 'posts_per_page', '18' );
    }

}
Source: http://www.billerickson.net/customize-the-wordpress-query/

Posted by: Sridhar Katakam Category: WordPress Tags: bill erickson, pre_get_posts

« Do Shortcode
Add Login/Logout menu items conditionally to Primary nav menu »

Copyright © 2026 · Genesis Sample on Genesis Framework · WordPress · Log in