Is there a parameter that can be passed to wp_list_categories, to get a certain number of posts from each category? Or a plugin that does something like that? A similar question was in the WordPress support forum, but it doesn’t do exactly what I want.
Leave a Reply
You must be logged in to post a comment.
The code that thread links to seems very close to what you are describing – looping through categories and retrieving some amount of posts for each.
If you want to integrate posts into
wp_list_categories()
you can do that by extendingWalker_Category
class and using it as custom walker passed viawalker
argument… but it’s not pretty for nested categories (I just tried and it seems to be messy to accurately insert posts).Some example code, I am not entirely sure it handles nesting properly: