Plugin Directory


Post Teaser

Tags: teaser, preview, statistics

Post Teaser generates a preview or "teaser" of a post for the main, archive and category pages, with a link underneath to go to the full post page. It includes features to generate a word count, image count, and an estimated reading time.

Reasons you might want to use Post Teaser:

  • You keep putting <!--more--> into your posts
  • You would like to save bandwidth by only having people view a full post if they actually want to read it
  • You just like the "teaser" format


NOTE: PLEASE DO NOT EMAIL JONATHAN LEIGHTON FOR SUPPORT. Instead contact Contact me for support.



Go to the new WordPress plugin directory for download and installation notes. The information on this page is outdated and currently updating this wiki page is not of priority.


Post Teaser does not need to be configured in order to work but some users understandably wish to change settings. That's easy too -- the dead simple configuration page can be found under Options > Post Teaser in your WordPress admin panel.

Frequently Asked Questions

Do I really need this plugin?

No, of course not, but it makes a nice addition and some people find it easier to skim over previews to find something that interests them rather than to scroll down huge chunks of text.

Help! I get an error that says "Warning: Cannot modify header information..."

This one is very common, and applies to any WordPress plugin. There must not be any content in the plugin file other than PHP code. Sometimes if people have copied the code into their own file, rather than downloading it, they accidentally leave whitespace or other characters at the beginning or end of the file, outside of the <?php ... ?> block. Removing any excess characters will solve the problem.

How can I apply presentation to the teaser text?

The teaser text is placed inside a block level <div> element with a class of "post-teaser". This means that you can use CSS to style the teaser text. As an example, here's the CSS you'd use to make it bold:

.post-teaser {
    font-weight: bold;

What if I don't want a particular post to be teasered?

You have two options here:

  1. Have Post Teaser ignore that post entirely
  2. Have Post Teaser "display the post in full", and display the message that it did so (like what happens if you have a post that is too short to be teasered)

Both of them work by using a custom field for you post. Here's how to do it:

  1. Edit/Write your post in the WordPress admin panel
  2. If you are not in the "Advanced" mode, then get into it by clicking the "Advanced Editing" button
  3. At the bottom of the form, where it says "Custom Fields", write 'teaser' in the box labelled "Key"
  4. Next, go to the "Value" box, and write 'disable' if you want Post Teaser to ignore the post entirely, or 'showall' if you want Post Teaser to return the post in full
  5. Click "Add Custom Field"

Can I choose where a post is teasered, rather than having it calculated?

Yes. You just write "<!--more-->" where you want it to be teasered, in the "traditional" WordPress style, and Post Teaser will do the rest.

I've got a problem or question that isn't answered here. Can you help me please?

Absolutely. Please use the contact form on my website, and I will get back to you as soon as I can.

Is this plugin available in other languages?

Yes. To use a translated version, you need to obtain the language file for it. At this point it would be useful to read Installing WordPress in Your Language from the Codex. You will need an .mo file for Post Teaser that corresponds with the "WPLANG" setting in your wp-config.php file. Translations are listed below -- if a translation for your language is available, all you need to do is place it in the wp-content/plugins directory of your WordPress installation. If one is not available, and you also speak good English, please consider doing a translation yourself (see the next question).

The following translations are available:

Can I provide a translation?

Of course! It will be very gratefully received. Please read Translating WordPress first for background information on translating. Then obtain the latest .pot file from http://svn.wp-plugins.org/post-teaser/trunk/post-teaser.pot and translate it. There are some strings with a space in front -- please make sure you remember the space'' When you have a translation ready, please send the .po and .mo files to han at sandboxblogger dot com. If you have any questions, feel free to email me also. Thanks!


NOTE: This is for historical purposes only; you don't really need to read it

Version 1.0

New features

  • Initial Plugin release : )

Version 2.0

New features

  • Preview generation is now more intelligent. You specify a target number of words in the $target_word_count variable and the plugin will output the number of blocks (elements that you specify) closest to this number of words. Thid means that if you have post starting with a paragraph of just a few words, the next paragraph will probably be shown too.
  • Added $no_zero_counts variable to leave out a count if it is zero. (For instance, if there are no images in a post, just the word count will be displayed if $no_zero_counts is set to true.)
  • Added "intelligence" option for $reading_time_unit. This returns estimated reading times in seconds if they are under 1 minute, and minutes if they are above or equal to one minute.
  • Added $reading_time_word_mins and $reading_time_word_secs variables. This is done because of the new "intelligence" option. The variables are used to specify what comes after the second/word count. (Like "14:35 mins", or "35 seconds").


  • The content of a post will not be altered if the post is protected, and the user has not entered the password for it. (In other words, we don't want to chop pieces out of the password entry form).
  • The plugin no longer alters the content of post previews in the admin interface.
  • Words in a post are now counted using str_word_count().
  • Word/image counts and estimated reading times are no longer calculated unless they are required.

Other changes

  • %word_count% and %image_count% condensed into %word_image_count% and a $word_image_count_separator variable has been added.

Version 2.1


  • Fixed to work with WordPress 1.5.
  • Stopped the plugin working in feeds.

Other changes

  • Changed licence to GPL; moved to WordPress plugins repository.

Version 3.0

New features

  • Configuration is now saved in the database, and there is a configuration panel under Options > Post Teaser
  • Support for debug output.
  • Added custom fields functionality so that Post Teaser can be turned off, or instructed to return the post in full regardless. Note that the latter will override <!--more-->.


  • Encoded quotes in %plain_title% to to "&quot;" entity so as not to break validation.
  • Included a bugfix for wpautop() (http://trac.wordpress.org/ticket/1099)
  • Cleaned up the code -- less useless comments, better efficiency
  • Changed the process a bit -- instead of excluding tags that would be cut in half, they are now closed automatically. Thus everything should validate without any tags having to be removed.
  • Compatibility with <!--nextpage--> and <!--more--> (via a very elaborate hack). As a bonus, Post Teaser will make <!--more--> tags resulting in invalid markup validate again (which could also be done with <!--nextpage--> but there is little point as it would just break as soon as the post is viewed at its permanant location)
  • Prevented smileys from being counted as images

Other changes

  • Made the whole thing a class
  • Removed "time_unit" configuration because it complicates things un-necessarily

Version 3.1

New Features

  • Added a button in the admin page to reset configuration to default values


  • Corrected the spelling of "Permanent" (previously said "Permanant") -- thanks Henrik Brameus
  • Used entities instead of UTF-8 characters, for compatibility -- thanks Mathias Bynens

Version 3.2


  • WordPress' "the_excerpt()" template tag is now replaced by the_content(). Post Teaser pretty much does what the_excerpt() does anyway, except better. This was a problem with Kubrick and its derivatives which use the_excerpt() on archive pages so Post Teaser appeared not to be working -- thanks Anders Devold
  • <!--more--> now works properly (it wasn't replaced if not surrounded by a p element) -- thanks Anders Devold
  • Special regular expression characters from get_permalink() are now escaped properly -- thanks Anders Devold (again!)
  • Resolved a conflict with Static Front Page -- thanks Ray

Version 3.3

New Features


  • Fixed a conflict with Semiologic CMS -- thanks Shawn

Version 3.4

New Features

  • Use the Fade Anything Technique in WordPress 2.0


  • Correctly count words using international characters
  • Documentation error: CSS class ".teaser-text" changed to ".post-teaser"

Version 3.5


  • Nested validation error occuring when using a <!--more--> tag -- due to WordPress 2 trying to ensure some level of validation (I think), but not completely, which results in Post Teaser trying to correct the validation and getting the nesting wrong -- thanks Leo Voloshin

Version 3.6


  • Lists can now be split with post teaser, instead of taking the "all or nothing" approach

Version 3.7


Version 3.8


Last modified 10 years ago Last modified on 05/09/08 20:36:28