Home Return first paragraph as excerpt | Excerpt-first-paragraph
Post
Cancel

Return first paragraph as excerpt | Excerpt-first-paragraph

Here is a neat little plugin that I use on my websites: excerpt-first-paragraph.

It does what it says, it returns the first paragraph as excerpt in your WordPress theme.

Setup

1. Download excerpt-first-paragraph.zip

2. Upload to plugins and activate

3. Replace the_excerpt in your theme with:

1
2
3
4
5
6
7
<pre lang="php"><?php
if($pos = strpos($post->post_content, '<!--more-->')) :
the_content(__(''));
else :
echo get_the_content_first_paragraph();
endif;
?>

Note: All images get cut out of the excerpt first paragraph.

And you are all set. No more blog entries cut off mid sentence with … 🙂 Enjoy having your first paragraph as an excerpt!

This post is licensed under CC BY 4.0 by the author.
Trending Tags