Skip to content

Instantly share code, notes, and snippets.

@matheusgimenez
Created October 25, 2014 21:47
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 matheusgimenez/5dd4776a086ba979dbc7 to your computer and use it in GitHub Desktop.
Save matheusgimenez/5dd4776a086ba979dbc7 to your computer and use it in GitHub Desktop.
function posts_in_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'posts_per_page', '1' );
$query->set('category_name', 'SLUG_DA_CATEGORIA');
}
}
add_action( 'pre_get_posts', 'posts_in_category' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment