Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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