WordPress.org

Support

Support » Themes and Templates » Keeping the formatting with “the_content_limit” tag

Keeping the formatting with “the_content_limit” tag

  • Dear gurus:

    I’m using “the_content_limit” tag in my theme to display a list of the three most recent posts, along with the first 300 words of the post. It works just fine, except that it does not use the text formatting that appears in the original post. For instance, if in the first 300 words there is one word or phrase that is italicised, the italicisation is not reproduced in the text displayed using the_content_limit.

    Is it not possible to keep this sort of formatting with the_content_limit, or is there an argument or CSS trick I need to know about?

    My usage:

    <?php the_content_limit(300, "[Read more...]"); ?>

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hedley –

    Did you ever find a solution for this? I’m also looking for the answer. People have recommended plugins but they either don’t work as advertised or aren’t very intuitive to use.

    Thanks!

    No, not so far. I haven’t had much time to experiment lately, though, either. One of these days…

    This may be of help to you guys.
    http://wordpress.org/support/topic/217004?replies=4

    Hi,

    You can keep the formatting of the post by the following steps:
    1. make sure you find the limit-post.php under plugins directory.
    2. open the file and comment the line on function the_content_limit:
    `$content = strip_tags($content);’

    this should keep the formatting of your posts.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Keeping the formatting with “the_content_limit” tag’ is closed to new replies.