Site icon Hip-Hop Website Design and Development

Stump the Chumps: How can I display an annual cycle of daily posts individually in a widget or block — and a full calendar view?

Once in a while, we get a “Stump the Chumps”-style How-To question submitted to Post Status by people who may be highly experienced with WordPress or trying to build their first site. All questions without easily googled answers are welcome — and we’ll run them by the members in Post Status Slack’s #learntogether channel.

Anyone can play! If you don’t mind being featured here as an expert/chump, please take a stab at answering (in the comments) our latest question from a WordPresser out there in the wild.

Educational (and entertaining) “minimalist” or “there’s a plugin/block for that” answers are preferred. 

I’ve added several possible solutions contributed in Post Status Slack by Tiffany Bridge, product manager at Nexcess/LiquidWeb, and Mark Root-Wiley of MRW Web Design — who helpfully augmented my own ideas. There’s room for more! What did we miss or get wrong?

The Question:

1. I am working on a “saint of the day” project for my website. There is a link on the homepage which should take the viewer to the saint for that day. I have created a page for each day. How do I make that link change automatically every day to the page for that day’s saint? 

2. I also need a calendar on the homepage where each day links to the page for that day’s saint. The archives calendar sort of does this but (a) it only shows an excerpt from the page and (b) the archives calendar is only on the sidebar and I need the calendar to be a main feature

— Anonymous Post Status Reader

Possible Solutions:

  1. A very simple solution that doesn’t add much to WordPress would be to make 365 posts (perhaps in a custom post type or category) published on each day of the year they correspond to at 00:00:00 hours. Some of the posts would be backdated and published in the past. Others would be scheduled to be published on future dates.
    • Displaying the latest post in the Saint’s Day category or content type would give you the daily saint content wherever you want it, using your choice of content display blocks and custom archive page templates. Tiffany Bridge suggests using a Latest Posts Gutenberg block set to display only one post, which would be the latest/current day’s saint, according to the website’s local time settings.*
    • Possibly a boon to your SEO, you would need to use an auto-republish posts plugin (there are several) to recycle your 365 saints’ posts annually, which would also give you a chance to update them and keep the content fresh. Alternatively, you could just move all the saints’ posts post-date year ahead by one every New Year’s Day at 000:00:00 using a run-once custom plugin, code snippet, or database query.
    • In this solution, it would be important not to use a chronological year/month/date permalink structure, although some auto-republish plugins can cope with that. (This may require a commercial license for those plugins.)
  2. An even simpler solution would be to create the 365 posts in a custom post type and then use Jeremy Herve‘s Posts on This Day plugin to display the current day’s saint in a widget position. However, this requires you to use widgets, which are going the way of the dinosaur as they’re replaced by blocks and full-site editing. You can still use a widget block to make use of Gutenberg and FSE with widgets, at least for the near term.
    • Tiffany Bridge suggests a similar solution using the On This Day plugin to display your blog posts from the current date in previous years as a sidebar widget. (The “On This Day” plugin allows you to enter historic or future events and display them with an included widget and shortcodes.) Tiffany notes there’s also a This Day in History plugin that has a ton of shortcode attributes that might work too. (Tiffany also located a Catholic Liturgy Calendar plugin that has offsite links to the saint of the day. This is a totally different, ready-made solution that may not work in this case, especially if a different liturgical calendar is being used.)

Almost any recent post display widget or block would work with these solutions, and the core calendar widget (or something like the Archives Calendar Widget) can be used in the main content area. (There’s a plugin or simple code solution to load widgets in the_content with shortcodes, but a future-facing Gutenberg solution would be better.) A really nice display for the unique purposes of a particular use-case would probably require some custom front-end work.

Focusing on the goal of having a nice display and interface, Post Status Member Mark Root-Wiley writes:

I don’t actually like this solution, but it would work to hack a calendar plugin with one event post per day. Then you get the calendar view for free  and use an “upcoming event” widget showing the next 1 event for your “X of the day.” But like I said, feels like abusing a tool.

*In all of these solutions (apart from using a good event calendar plugin) one potential gotcha is that visitors on the other side of the international date line would be shown the wrong saint, relative to their local date/time. If that’s a concern, you could use chronological permalinks for your saints’ posts and a simple PHP (date) or WordPress (function date_i18n) to link to the proper URL based on the local date. And then make sure that link doesn’t get cached.

What’s your solution? Tell us in the comments.

And come learn with us at Post Status!

You — and your whole team can Join Post Status too!

Build your network. Learn with others. Find your next job — or your next hire. Read the Post Status newsletter. Listen to podcasts. Follow @Post_Status.