Skip to content

Instantly share code, notes, and snippets.

@HandyGadget
Last active December 15, 2015 13:58
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 HandyGadget/5270605 to your computer and use it in GitHub Desktop.
Save HandyGadget/5270605 to your computer and use it in GitHub Desktop.
Alternative Genesis loop that handles blog posts with the category "Projects" within a page.
<?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();
/* Cornerstone Loop
<?php if ( cnr_have_children() ) : while ( cnr_have_children() ) : cnr_next_child(); ?>
<h3><?php the_title(); ?></h3>
<div><?php the_excerpt(); ?></div>
<?php endwhile; endif; ?>
*/
@HandyGadget
Copy link
Author

I can see how this Projects template displays posts by category in the loop.

The commented code at the bottom displays the title and an excerpt with a link for each post in a section (a page).

How do I replace the loop in Genesis with a loop that loads post URLs rather than categories?

The goal is to not use a blog but end up with a structure like this http://domain.com/page/comment/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment