• Hi,

    I’m trying to truncate some text using the following:

    <?php $excerpt = get_the_excerpt(); echo jobseek_string_limit_words($excerpt,200); ?>

    However, it seems to be stopping after 26 words.

    Any ideas why this is?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • I would have to see the function you are calling there. However, you are already calling the get_the_excerpt function, which already gives you a small excerpt of the post, and that is why may be you are getting only 26 words.

    Try using get_the_content función instead

    Thread Starter thetoolman123

    (@thetoolman123)

    Thanks for the reply.

    I’ve now tried this:

    <?php $excerpt = get_the_content(); echo jobseek_string_limit_words($excerpt,200); ?>

    which seems to output everything rather than truncating it.

    Can you do a pastebin of this function:

    jobseek_string_limit_words

    Moderator bcworkz

    (@bcworkz)

    Instead of using jobseek_string_limit_words() to limit the output, you could rely on get_the_excerpt() along with the ‘excerpt_length’ filter alone. The ‘excerpt_length’ filter allows you to change the default excerpt length of 55 to anything you want, such as 200.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Truncating words’ is closed to new replies.