Skip to content

Instantly share code, notes, and snippets.

@jekkilekki
Last active September 22, 2015 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jekkilekki/29937e82f04f7ae2d98d to your computer and use it in GitHub Desktop.
Save jekkilekki/29937e82f04f7ae2d98d to your computer and use it in GitHub Desktop.
Better Post excerpts for WordPress
/**
 * Fancy excerpts
 * 
 * @link: http://wptheming.com/2015/01/excerpt-versus-content-for-archives/
 */
function the_fancy_excerpt() {
    global $post;
    if ( has_excerpt() ) :
        the_excerpt();
    elseif ( @strpos ( $post->post_content, '<!--more-->' ) ) :
        the_content();
    elseif ( str_word_count ( $post->post_content ) < 200 ) :
        the_content();
    else :
        the_excerpt();
    endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment