On This Day
A widget that displays a 2x2 grid of posts from the current date in the last four years
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mattgharvey/otd/archive/refs/heads/main.zipOn This Day - WordPress Widget Plugin
A WordPress plugin that displays a 2x2 grid of posts from the current date across the last four years.
Description
The "On This Day" plugin adds a customizable widget that showcases posts published on the current date (month and day) from the previous four years (1-4 years ago). Perfect for highlighting historical content and encouraging visitors to explore your archive.
Features
- 📅 Automatically displays posts from today's date from 1-4 years ago
- 🎨 Beautiful 2x2 responsive grid layout
- 📆 Year labels on each card
- 🖼️ Featured image support with hover effects
- 🔗 "See More..." link to view all posts from this day across all years
- 📄 Custom archive page for browsing all posts from a specific day
- 📱 Mobile-friendly responsive design
- 🌓 Dark mode support
- 🎨 Monochrome design that inherits your theme's link colors
- ⚙️ Customizable widget title
- 🎯 Easy to use - just add the widget to your sidebar or widget area
Installation
- Upload the
otdfolder to the/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Go to Settings → Permalinks and click "Save Changes" to register the archive page URLs
- Go to Appearance → Widgets
- Add the "On This Day" widget to your desired widget area
- Customize the title (optional) and save
File Structure
otd/
├── on-this-day.php # Main plugin file
├── includes/
│ └── class-otd-widget.php # Widget class
├── assets/
│ └── css/
│ └── style.css # Widget styles
└── README.md # This file
How It Works
The plugin queries your WordPress database for posts published on the current month and day from:
- One year ago
- Two years ago
- Three years ago
- Four years ago
It displays up to one post from each year in a 2x2 grid format. The widget also includes a "See More..." link that takes users to an archive page showing ALL posts from the current day throughout your site's history.
Customization
Modifying the Date Range
To change the number of years displayed, edit the $years array in includes/class-otd-widget.php.
Styling
All styles are contained in assets/css/style.css. You can customize:
- Grid layout and spacing
- Colors and fonts
- Hover effects
- Responsive breakpoints
Post Types
By default, the widget displays standard posts. To include custom post types, modify the post_type parameter in the get_posts_from_this_day() method.
Requirements
- WordPress 5.0 or higher
- PHP 7.0 or higher
Support
For issues, questions, or contributions, please visit: https://github.com/MattGHarvey/otd
License
GPL v2 or later
Changelog
1.0.0
- Initial release
- 2x2 grid layout
- Responsive design
- Featured image support
- Dark mode support