Support » Fixing WordPress » Limit wp_get_archives to show certain number of words per line

  • AkaMaDdiSk


    Hi, I’m trying to use wp_get_archives to display a list of recent posts. I understand there is a “limit” parameter that you can use to set the maximum number of posts that it displays. However, is there a way to specify the number of words per post title? Basically I would like the list of recent post to be one line each. If the title of a recent posts is longer than, say, 6 words, then I would like for it to only show “…” in place of the remaining words in the title.

    How can this be done?

    Much thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • MichaelH




    Thanks for this. But this seems to be only targetted for the_excerpt and the_content. I’m trying to limit words for the_title.

    Any other ideas?



    Does anyone have any ideas? I have a list of recent posts on my sidebar but instead of showing the whole title I’d like for it to show a limited number of characters:

    >> This is the first post that…
    >> Here comes the next post of…
    >> Another example post here to…

    Something like the above.

    Currently in my template I’m using this

    <?php wp_get_archives(‘title_li=&type=postbypost&limit=8’); ?>

    Any help would be appreciated.



    Anyone know this?

    Apologies for the bump….anyone?

    Any help please?

    I don’t see how you can do this with wp_get_archives due to this template tag’s output and because it is not a built in parameter.

    Although it would require knowing/learning some php, you may be able to do it with a second loop and using the_title() as a php variable with display set to false in php substr to limit the number of characters. There are ways to do so, but I haven’t learned yet how to limit the number of words with php.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Limit wp_get_archives to show certain number of words per line’ is closed to new replies.