Skip to content

Instantly share code, notes, and snippets.

@braddalton
Last active December 14, 2015 03:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save braddalton/5021515 to your computer and use it in GitHub Desktop.
Save braddalton/5021515 to your computer and use it in GitHub Desktop.
Custom Genesis blog page loop with exclude posts from one category
<?php /*
Template Name: Exclude Categories
*/
/** Custom Genesis loop */
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_do_custom_loop' );
function child_do_custom_loop() {
global $paged;
global $query_args; // grab the current wp_query() args
$args = array(
'category__not_in' => -30, // exclude posts from category i.d 30
'paged' => $paged,
);
genesis_custom_loop( wp_parse_args($query_args, $args) );
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment