Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created February 13, 2013 19:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/4947529 to your computer and use it in GitHub Desktop.
Save billerickson/4947529 to your computer and use it in GitHub Desktop.
<?php
/**
* Grid Content
* Change the number of words in excerpt if in the grid loop
*/
function be_grid_content() {
// First, we make sure we're in the grid loop.
if( ! be_grid_loop_pagination() )
return;
// Change length if teaser
if( in_array( 'teaser', get_post_class() ) )
$length = 20;
else
$length = 55;
echo '<p>' . wp_trim_words( get_the_excerpt(), $length ) . '</p>';
}
add_action( 'genesis_post_content', 'be_grid_content' );
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment