Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created March 15, 2012 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save billerickson/2045807 to your computer and use it in GitHub Desktop.
Save billerickson/2045807 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 );
}
}
@GaryJones
Copy link

The documentation is out of sync with the code (nothing to do with attachments).
Also, the @SInCE should go under the long description (bit about 27 per page).

@billerickson
Copy link
Author

Updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment