Genesis Grid Loop

New in Genesis 1.5

CSS:

/* Featured Post Grid
------------------------------------------------------------ */
 
.genesis-grid-even {
    float: right;
    padding: 0 0 15px;
    width: 48%;
}
 
.genesis-grid-odd {
    clear: both;
    float: left;
    padding: 0 0 15px ;
    width: 48%;
}
 
.genesis-grid-even,
.genesis-grid-odd {
    margin: 0 0 20px;
}

PHP:

/* functions.php:
------------------------------------------------------------ */

add_image_size('grid-thumbnail', 100, 100, TRUE);

/* home.php:
------------------------------------------------------------ */

<?php
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'pretty_grid_loop_helper' );
/** Add support for Genesis Grid Loop **/
function pretty_grid_loop_helper() {
    if ( function_exists( 'genesis_grid_loop' ) ) {
        genesis_grid_loop( array(
            'features' => 2,
            'feature_image_size' => 0,
            'feature_image_class' => 'alignleft post-image',
            'feature_content_limit' => 0,
            'grid_image_size' => 'grid-thumbnail',
            'grid_image_class' => 'alignleft post-image',
            'grid_content_limit' => 0,
            'more' => __( '[Continue reading...]', 'genesis' ),
            'posts_per_page' => 6,
        ) );
    } else {
        genesis_standard_loop();
    }
}

/** Remove the post meta function for front page only **/
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
 
genesis();

/*
Understanding the Parameters
------------------------------------------------------------ *//*

'features'
This is the number of posts that will show at the top of the page.

'feature_image_size'
This is the size of the featured image in the features section to be shown (set to 0, which will return no image).

'feature_image_class'
This is where classes are assigned to the featured image in the features section which can be used for styling.

'feature_content_limit'
This is where you can specify the number of characters of the post to show in the features section (set to 0, which will return the full content).

'grid_image_size'
This is the size of the image in the grid section to be shown (set to 0, which will return nothing).

'grid_image_class'
This is where classes are assigned to the featured image in the grid section which can be used for styling.

'grid_content_limit'
This is where you can specify the number of characters of the post to show in the grid section (set to 0, which will return the post excerpt).

'more'
This is where you can specify the text that is displayed when using the content limit option.

'posts_per_page'
This is were you can determine how many posts are shown on each page.
*/

Leave a Comment