AkaMaDdiSk
Member
Posted 3 years ago #
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.
AkaMaDdiSk
Member
Posted 3 years ago #
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?
AkaMaDdiSk
Member
Posted 3 years ago #
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.
AkaMaDdiSk
Member
Posted 3 years ago #
AkaMaDdiSk
Member
Posted 3 years ago #
Apologies for the bump....anyone?
AkaMaDdiSk
Member
Posted 3 years ago #
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.