Twitter
1.0
Limit-Post Add-On
13. July 2009 · Author: Dale Crum
92 Comments

Limit-Post Add-On

Limit-Post is one of the better WordPress post content limiters we have come across, both in terms of usability and size. Developed by labitacora.net Limit-Post provides excellent control over the post character-length and even adds the ability to create “read more …” link with a single line of code.

From labitacora.net: “We have developed a plugin for WordPress in order to control the maximum amount of characters displayed for an entry on the main page. If the set limit is surpassed a link to a page with the whole content will appear and the text on the entry will be chopped to that amount of characters, otherwise the content will be show[n] unchanged.”

It came to our attention not long ago that we needed to make use of the WordPress tag; get_the_content. For those unfamiliar, WordPress supplies two methods of displaying the post content through php;

Option#1: the_content(); – The more familiar method of displaying the post content
Option #2: get_the_content(); – The less familiar content tag which strips all html tags

Option #2 is useful for listing articles or news without interruption of paragraph breaks, block-quotes or links which can easily disrupt a strict layout. Not wanting to reinvent the wheel, we wrote a short addition to the Limit-Post plugin giving it the added feature of the get_the_content(); tag.

In the example below, the post content is displayed with all html stripped out, 320 characters in length and a continue link of “read more…”. For further instructions on the Limit-Post options please visit labitacora.net. Limit-Post is a very resilient plugin having remained functional since it’s inception in 2005 during the WordPress 1.5 era. It continues to function perfectly with WordPress 2.7.1.

Please note that because all html is stripped, it will be necessary to add paragraph tags around the content.

Example

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_title(); ?>
<p><?php get_the_content_limit(320, 'read more...'); ?></p>
<?php endwhile; endif; ?>

Installation

  1. Download the plugin and expand it.
  2. Copy the limitpost-addon folder into your plugins folder ( wp-content/plugins ).
  3. Log-in to the WordPress administration panel and visit the Plugins page.
  4. Locate the Limit Post plugin and click on the activate link.
  5. Replace the_content(); with the_content_limit(200, "continue..."); or
  6. Replace the_content(); with get_the_content_limit(200, "continue...");

Trackbacks

    Leave A Comment

    Please wrap any code within the <code> tag to display properly

    Incorporating animals into identities is not a groundbreaking topic by any means but making the design work on a professional level isn't always an easy task. Making use of an artist's...

    It's Christmas time, so I thought I would have a little fun with my article this month, not that I don't usually have fun. Since we are all designers, what better topic to discuss than...

    After reading hundreds of articles and design newsletters over the years showcasing websites as a source of inspirational material we felt it was our turn to give back to the community....

    When you own a small business, competing with the top dogs in the market can be a financial and time-consuming challenge. How do you get the word out about your business without spending...

    If you are reading this article then you are probably a graphic designer or work in marketing in some form or fashion. That being said, you probably own your own company, freelance,...