WordPress Custom Excerpt

/** * CUSTOM EXCERPT *********************************************************************** */ $excerpt_length = 70; // enter in your own custom character limit. // add more link to excerpt function excerpt_read_more_link($output) { global $post; global $excerpt_length; if( strlen($output) > $excerpt_length ) { return $output . '<p class="more-link"><a href="'. get_permalink($post->ID) . '"> Read More</p>'; } else { return $output; } } add_filter('the_excerpt', 'excerpt_read_more_link');
WP Function to customize the_excerpt() function from WP default the_excerpt(). Place code in functions.php.

1 Response

echo wp_trim_words( $post -> post_content, $num_words = 70, $more = '...' );

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.