Site icon WP Smith

How to Write a Genesis Custom Loop for Specific Categories in a Genesis Page Template

So I was creating page templates that called for a custom loop for specific categories that I blocked from my blog in my Genesis Settings. To do this, use this page template.

You do not need to use 'cat' which requires the category ID; however, it is always my preference. You can also choose from wp_query:

[php]
<?php
/**
*
* Template Name: Projects
* This file handles blog posts with the category Projects within a page.
*
*/

remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'custom_do_cat_loop');

function custom_do_cat_loop() {
global $query_args; // any wp_query() args
$args= array('cat' => '30');
genesis_custom_loop(wp_parse_args($query_args, $args));
}

genesis();

[/php]