Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
remove_action('genesis_before_post_content', 'genesis_post_info');
remove_action('genesis_post_title', 'genesis_do_post_title');
// Use the prepared grid loop
add_action( 'genesis_loop', 'minimum_tn_do_grid_loop' );
function minimum_tn_grid_switch_content() {
remove_action('genesis_post_content', 'genesis_grid_loop_content');
add_action('genesis_post_content', 'minimum_tn_grid_loop_content');
}
add_action('genesis_before_post', 'minimum_tn_grid_switch_content');
function minimum_tn_grid_loop_content() {
global $_genesis_loop_args;
if ( $_genesis_loop_args['grid_image_size'] ) {
printf( '<a href="%s" title="%s" rel="nofollow">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), genesis_get_image( array( 'size' =&gt; $_genesis_loop_args['grid_image_size'], 'attr' =&gt; array( 'class' =&gt; esc_attr( $_genesis_loop_args['grid_image_class'] ) ) ) ) );
}
printf( '<a href="%s" rel="nofollow">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ) );
}
// Add some extra post classes to the grid loop so we can style the columns
add_filter( 'genesis_grid_loop_post_class', 'minimum_tn_grid_loop_post_class' );
function minimum_tn_grid_loop_post_class( $grid_classes ) {
global $_genesis_loop_args, $loop_counter;
// Alter this number to change the number of columns - used to add class names
$columns = 4;
// Only want extra classes on grid posts, not feature posts
if ( $loop_counter &gt;= $_genesis_loop_args['features'] ) {
// Add genesis-grid-column-? class to know how many columns across we are
$grid_classes[] = sprintf( 'genesis-grid-column-%s', ( ( $loop_counter - $_genesis_loop_args['features'] ) % $columns ) + 1 );
// Add size1of? class to make it correct width
$grid_classes[] = sprintf( 'size1of%s', $columns );
}
return $grid_classes;
}
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'minimum_grid_loop_helper' );
/** Add support for Genesis Grid Loop **/
function minimum_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'post_type' =&gt; 'projects',
'taxonomy' =&gt; 'classification',
'term' =&gt; ' identity ',
'features' =&gt; 0,
'feature_image_size' =&gt; 0,
// 'feature_image_class' =&gt; 'alignleft post-image',
'feature_image_class' =&gt; 'post-image',
'feature_content_limit' =&gt; 0,
'grid_image_size' =&gt; 'port-grid-thumbnail',
// 'grid_image_class' =&gt; 'alignleft post-image',
'grid_image_class' =&gt; 'portfolio-tn-img',
'grid_content_limit' =&gt; 0,
'more' =&gt; __( '[Continue reading...]', 'genesis' ),
'posts_per_page' =&gt; 20,
) );
} else {
genesis_standard_loop();
}
}
/** Remove the post meta function for front page only **/
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.