Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidperezgar/6ab831b4d052d2ce458f292564e09bed to your computer and use it in GitHub Desktop.
Save davidperezgar/6ab831b4d052d2ce458f292564e09bed to your computer and use it in GitHub Desktop.
Archive Query
<?php
add_filter( 'pre_get_posts', 'be_archive_query' );
/**
* Archive Query
*
* Sets all archives to 27 per page
* @since 1.0.0
* @link http://www.billerickson.net/customize-the-wordpress-query/
*
* @param object $query
*/
function be_archive_query( $query ) {
if( $query->is_main_query() && $query->is_archive() ) {
$query->set( 'posts_per_page', 27 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment