1

I have a sidebar on our intranet which lists, hierarchically, posts by category.

Such as:

-- HR
---Events
----Picnic

However, this list has gotten long, and some categories are no longer even used. I would like to only category links where there are posts less than a year old.

Right now, I am using the default Categories Widget in the sidebar, but I can use a different widget or hand-code it.

How would I best approach this?

0

I'm not sure if this question is correctly tagged since you mentioned you're using the Categories Widget. The tag is for the List Category Posts plugin.

Using the plugin, the first possible thing that comes to my mind is using the few available date parameters:

monthnum and year - List posts from a certain year or month. You can use these together or independently. Example: [catlist year=2015] will list posts from the year 2015. [catlist monthnum=8] will list posts published in August of every year. [catlist year=2012 month=12] will list posts from December 2012.

This is not available on the widget (yet), but you could add it as a shortcode in your template file:

<?php echo do_shortcode("[catlist id=3]"); ?>
  • I didn't realize I tagged it the plugin, sorry. I'll try that solution, though, thanks. – Steve Mar 12 '13 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.