Support » Fixing WordPress » the_content() character limit

  • Hello,

    is there any way to limit characters in loop for the content f-tion? I have different post templates in the page so I want to in one place to set limit 100 characters in second place set limit 200characters at the same post like this for example:

    the_content(‘word to display’, ‘character limit’);
    the_content(‘more’, 100);

    is there any solution? Thanks

Viewing 1 replies (of 1 total)
  • You could set a global variable with the number of characters and create a filter on the_content which would check for that global variable and truncate the content.

    However, you should be aware that truncating the content will most likely cause corrupt HTML unless you take special care to preserve it. The function the_excerpt() removes all HTML just to prevent this type of problem.

Viewing 1 replies (of 1 total)
  • The topic ‘the_content() character limit’ is closed to new replies.