Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Multiple Excerpt
- function croque_pixel_excerpt( $charlength, $excerpt = false, $excerpt_more = true ) {
- if( ! $excerpt) {
- $excerpt = get_the_excerpt();
- }
- // Remove shortcodes for excerpt
- $excerpt = strip_shortcodes( $excerpt );
- $charlength++;
- if( strlen( $excerpt ) > $charlength ) {
- $subex = substr( $excerpt, 0, $charlength-5 );
- $exwords = explode(" ",$subex);
- $excut = -( strlen( $exwords[count( $exwords )-1] ) );
- if( $excut < 0 ) {
- $new_excerpt = substr( $subex, 0, $excut );
- } else {
- $new_excerpt = $subex;
- }
- if( true == $excerpt_more ) {
- $new_excerpt .= "...";
- }
- } else {
- $new_excerpt = $excerpt;
- }
- return $new_excerpt;
- }
Add Comment
Please, Sign In to add comment