Keeping the formatting with "the_content_limit" tag (5 posts)

  1. Hedley
    Posted 7 years ago #

    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...]"); ?>


  2. stephanieV
    Posted 6 years ago #

    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.


  3. Hedley
    Posted 6 years ago #

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

  4. NNDT
    Posted 6 years ago #

    This may be of help to you guys.

  5. shirgans
    Posted 6 years ago #


    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.

Topic Closed

This topic has been closed to new replies.

About this Topic