Skip to content

Instantly share code, notes, and snippets.

@tac-design
Created August 11, 2016 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tac-design/048e8a616e3bd2fba7c02af3ae44c507 to your computer and use it in GitHub Desktop.
Save tac-design/048e8a616e3bd2fba7c02af3ae44c507 to your computer and use it in GitHub Desktop.
<?php
//example function to customise query
function tac_customise_query( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
if ( is_post_type_archive( 'post' ) ) {
$query->set( 'posts_per_page', 9 );
return;
}
}
add_action( 'pre_get_posts', 'tac_customise_query', 1 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment