Advertisement
srikat

Untitled

May 13th, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. /**
  2. * Grid Content
  3. * Change the number of words in excerpt if in the grid loop
  4. */
  5. function kat_grid_content() {
  6.  
  7. // First, we make sure we're in the grid loop.
  8. if( ! apply_filters( 'is_genesis_grid_loop', false ) )
  9. return;
  10.  
  11. // Change length if teaser
  12. if( in_array( 'teaser', get_post_class() ) )
  13. $length = 25;
  14. else
  15. $length = 55;
  16.  
  17. echo '<p>' . wp_trim_words( get_the_excerpt(), $length ) . '</p>';
  18.  
  19. // Display more link
  20. echo '... <a class="more-link" href="' . get_permalink() . '">Continue Reading</a>';
  21.  
  22. // Remove default content so we don't get both
  23. remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
  24. }
  25. add_action( 'genesis_entry_content', 'kat_grid_content', 9 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement