Skip to content

Instantly share code, notes, and snippets.

Last active December 21, 2015 01:49
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
* 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( ! apply_filters( 'is_genesis_grid_loop', false ) )
// Only display excerpt if not a teaser
if( !in_array( 'teaser', get_post_class() ) )
echo '<p>' . wp_trim_words( get_the_excerpt(), $length ) . '</p>';
// Remove default content so we don't get both
remove_action( 'genesis_post_content', 'genesis_do_post_content' ); // For Genesis 1.x
remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); // For Genesis 2.x
add_action( 'genesis_post_content', 'be_grid_content', 9 ); // For Genesis 1.x
add_action( 'genesis_entry_content', 'be_grid_content', 9 ); // For Genesis 2.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment