我使用它从循环中排除特定类别。它做到了这一点,但它也做到了这一点:在我的页面上,它显示了除此之外的其他类别的帖子。
/** Replace the standard loop with our custom loop */
remove_action( \'genesis_loop\', \'genesis_do_loop\' );
add_action( \'genesis_loop\', \'child_do_custom_loop\' );
function child_do_custom_loop() {
global $paged; // current paginated page
global $query_args; // grab the current wp_query() args
$args = array(
\'category__not_in\' => 7, // exclude posts from this category
\'paged\' => $paged, // respect pagination
);
genesis_custom_loop( wp_parse_args($query_args, $args) );
}