Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My goal is to not use a separate blog page but end up with a structure like this...

http://domain.tld/page/comments/

I believe I can do this with the Cornerstone plugin ~ [ http://wordpress.org/extend/plugins/cornerstone/ ] ~ but I can’t figure out the alternative loop code and how I replace the loop in Genesis with a loop that loads post URLs rather than categories.

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

// GENESIS LOOP

<?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; ?>

The Cornerstone loop displays the title and an excerpt with a link for each post in a section (a page) in Cornerstone.

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

I am a designer, not a developer, so any help you can give me would be much appreciated.

Terence.

share|improve this question
    
As the issues appear to be specific to Genesis and the Cornerstone Plugin, have you consulted Genesis support, or the Cornerstone Plugin support forum at WPORG? –  Chip Bennett Mar 29 '13 at 17:12
    
Thanks Chip. Everyone seems to develop a case of "slopey shoulders" when they see me coming. The author of the Cornerstone plugin offers me encouragement and points me to others who might know the answers, but no real help when it comes to specific framework implementation. And that was in the WPORG support forum. –  Terence Milbourn Mar 29 '13 at 18:00
    
Genesis support did the same. I am between a rock and a hard place. –  Terence Milbourn Mar 29 '13 at 19:22

2 Answers 2

The Genesis Framework is not for free, so I can't inspect the code. But I can use Google or any other search engine and found something with custom post types. And as I see the comment // any wp_query() args, I guess you can pass the same arguemnts to the Genesis loop as to the normal wp_query (especially the part with 'Multiple Posts/Pages Handling').

function custom_do_cat_loop() {
  global $query_args; // any wp_query() args
  $per_page = 10;
  $args= array(
    'post_type' => 'post',
    'posts_per_page' => $per_page,
    'paged' => get_query_var( 'paged' )
  );
  genesis_custom_loop( wp_parse_args( $query_args, $args ) );
}

This solution is a shot in the dark, but maybe it help you to find more informations on the web.

share|improve this answer

Genesis does not provide a method to replace the normal loop structure. You're stuck with the old standard in genesis_standard_loop():

if ( have_posts() ) : while ( have_posts() ) : the_post();

or new query in genesis_custom_loop() (with call back to genesis_standard_loop()):

$wp_query = new WP_Query( $args );

/** Only set $more to 0 if we're on an archive */
$more = is_singular() ? $more : 0;

genesis_standard_loop();

To add the plugin loop, replace genesis_custom_loop() with your own loop.

1) Make a copy of genesis_standard_loop() (In future HTML5 versions of Genesis copy genesis_legacy_loop(). Located in /themes/Genesis/lib/structure/loops.php),

2) Rename it with a new prefix like this: wpse_93883_custom_loop(),

3) Replace the following line:

if ( have_posts() ) : while ( have_posts() ) : the_post();

With the plugin code:

if ( cnr_have_children() ) : while ( cnr_have_children() ) : cnr_next_child();

4) Add this somewhere above the call to genesis(); in the template file:

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

5) Place the new function below step 4 (in the template file).

6) Making these changes should keep all the expected Genesis custom actions. To add the title and content use this somewhere above the call to genesis();:

add_action( 'genesis_post_title', 'wpse_93883_post_title' );
function wpse_93883_post_title() {
    printf( '<h3>%s</h3>', get_the_title() );
}

add_action( 'genesis_post_content', 'wpse_93883_post_content' );
function wpse_93883_post_content() {
    the_excerpt();
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.