• Hi – I have a category of blog posts, and there are many posts for each day of the year, and I’m hoping to somehow display these posts on the home page, so that on April 22nd, all posts from all years, on April 22nd, will display as thumbnails from – I don’t know – maybe a short code?

    These are homicide victims and missing persons, so the idea is to highlight those taken “On this day in history”.

    Is this easy to do with a modified Loop? I’m a WordPress newb, but have been hacking in Joomla for a few years…

    Any suggestions would be much appreciated.

    Thanks

    Bill

Viewing 5 replies - 1 through 5 (of 5 total)
  • This should be able to do using a WP_Query loop. Let me see what I can come up with. Give me a few.

    There are a few plugins out there that will manage ‘this day in history’ type shortcodes and widgets, but that seems like it has more than you need.

    This GIST can be downloaded as a .php file and put into your wp-content/plugins folder. Then you should be able to activate it like any other plugin.

    https://gist.github.com/cklosowski/105ee825cf9d21176dc5

    You could then create a page, put the [on_this_date] shortcode on it, and set your homepage as a static page (Settings->Reading->Front Page Display)
    https://cloudup.com/ccF__XZSdpN

    Obviously you’ll need to style this a bit better, but should get you on your way!

    – Chris

    Thread Starter billium99

    (@billium99)

    Thanks so much! That will get me started.

    Actually, is it too much trouble to filter on a given post category? I’m guessing we’ll have numerous categories but only one to display in this manner.

    Or would it need to be a custom post type?

    Bill

    You could do either a custom post type, or a category. Category would be much less involved, unless you’ve already written the custom post type integration. I’ve updated the GIST to contain a category reference. You’d want to look it up by the category ID (which is numeric).

    https://gist.github.com/cklosowski/105ee825cf9d21176dc5#file-on_this_date-php-L15

    If you’ve already written the custom post type, swap ‘cat’ for ‘post_type’, and the value being the custom post type you’ve setup.

    Thread Starter billium99

    (@billium99)

    Thanks Chris – that’s great!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Posts on this date in history’ is closed to new replies.