Created
March 20, 2013 20:15
-
-
Save DMSpeed/5208045 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? 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( ! apply_filters( 'is_genesis_grid_loop', false ) ) | |
return; | |
// Change length if teaser | |
if( in_array( 'one-half teaser', get_post_class() ) ) { | |
$length = 60; | |
} | |
else { | |
$length = 400; | |
//print_r(get_post_class()); | |
} | |
echo '<p>' . wp_trim_words( get_the_content() , $length ) . '</p>'; | |
// Remove default content so we don't get both | |
remove_action( 'genesis_post_content', 'genesis_do_post_content' ); | |
} | |
add_action( 'genesis_post_content', 'be_grid_content', 9 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment