Last active
December 15, 2015 13:58
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; ?> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/