Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active August 29, 2015 14:27
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 srikat/aaada72e31fc82fe5ff9 to your computer and use it in GitHub Desktop.
Save srikat/aaada72e31fc82fe5ff9 to your computer and use it in GitHub Desktop.
// Set content limit to 250 words
function sk_content_limit() {
return '250';
}
// Modify the Genesis content limit read more link
add_filter( 'get_the_content_more_link', 'sp_read_more_link' );
function sp_read_more_link() {
return '... <a class="more-link" href="' . get_permalink() . '">[Read more]</a>';
}
//* Genesis grid loop
function minimum_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 0,
'feature_image_size' => 0,
'feature_content_limit' => 0,
'grid_image_size' => 0,
'grid_content_limit' => 250,
'more' => __( '[Read more]', 'minimum' ),
) );
} else {
genesis_standard_loop();
}
}
//* Genesis grid loop
function minimum_grid_loop_helper() {
global $paged;
// Fix for the WordPress 3.0 "paged" bug.
$paged = 1;
if ( get_query_var( 'paged' ) ) {
$paged = get_query_var( 'paged' );
}
if ( get_query_var( 'page' ) ) {
$paged = get_query_var( 'page' );
}
$paged = intval( $paged );
// arguments, adjust as needed
$args = array(
'posts_per_page' => 6,
'paged' => $paged
);
/**
* Display as Columns
*
*/
function sk_grid_post_class( $classes ) {
global $wp_query;
$classes[] = 'genesis-grid';
$classes[] = ( $wp_query->current_post % 2 == 0 ) ? 'genesis-grid-odd' : 'genesis-grid-even';
return $classes;
}
add_filter( 'post_class', 'sk_grid_post_class' );
// Force content limit
add_filter( 'genesis_pre_get_option_content_archive_limit', 'sk_content_limit' );
genesis_custom_loop( $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment