Plugin Directory

FunkyPress First Sentence Highlighter

Author: Joss Crowcroft

The FunkyPress First Sentence Highlighter adds a new Template Tag fp_firstsentence( $str , $style , $br ), which highlights the first sentence in a string/content ($str) with a specified CSS style ($style) - for example: "font-size:14.5px;font-weight:bold;color:#990000;".

Works charmingly well with get_the_content() or get_the_excerpt() to add Newspaper-style emphasis on post content.

This beautifully simple function allows you to add emphasis to the first sentence of a post without actually specifying it in the post editor, thus the post will display as normal on its single page.

Places where this function comes in handy:

  • To add emphasis to each entry in an archive list.
  • To create a Newspaper/Magazine-style lead-in on a featured post on the front page.
  • To highlight the first sentence of posts in a certain category (i.e. Featured) when browsing archives.
  • So many more possible uses! See the screenshots and Plugin Homepage for examples.

NB: By default, $br = 1, meaning that the function will preserve line/paragraph breaks in the content. You can optionally specify $br = 0 to have the function echo a block of text with no breaks.

Check out the screenshots for examples, and a live demo at the Plugin Homepage

Much Love,

Download

FYI

Compatibility beta

Your Setup

Log in to vote.

The Consensus

No data

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(2 ratings)