SHOW:
|
|
- or go back to the newest paste.
1 | function zfly9_custom_excerpt( $content ) { | |
2 | - | if ( ! is_single() ) { |
2 | + | if ( ! is_singular() ) { |
3 | - | return substr( $content, 0, 400 ) . ' <a class="more-link" href="' . esc_url( get_permalink() ) . '">Read more!</a>'; |
3 | + | $content = wp_trim_words( $content, 55 ) . ' <a class="more-link" href="' . esc_url( get_permalink() ) . '">Read more!</a>'; |
4 | - | } else { |
4 | + | |
5 | - | return $content; |
5 | + | |
6 | return $content; | |
7 | } | |
8 | add_filter( 'the_content', 'zfly9_custom_excerpt' ); |