Shortcode Year and Date
Dynamic year, date with ordinal suffix, and post-published shortcodes for WordPress. Multilingual EN, ES, IT, FR, DE, WPML-aware, cached, and cron-cleaned for fast, accurate output.
Display the current year, today’s date with the correct ordinal suffix, or a post’s published date – automatically and in multiple languages. Shortcode Year and Date is WPML-aware, caches output, prunes stale transients via cron, and wraps results in styled spans for easy theming.
$7
Plugin Overview
The Shortcode Year and Date plugin offers dynamic date and year shortcodes with full multilingual support. Use simple shortcodes to display the current year, the current date with ordinal suffixes (like “1st”, “2nd”), and post-published dates in multiple languages. It caches the output for improved performance and offers easy language override via shortcode attributes.
Key features & benefits
- Dynamic year display: Use the [ year ] shortcode to show the current year.
- Formatted date with ordinal suffixes: The [ date ] shortcode displays the current date with suffixes (like “2nd”, “23rd”).
- Post-published date: Show the publication date of a post with the [ post-published ] shortcode.
- Multilingual support: Supports English, Spanish, Italian, French, and German, with automatic language detection or manual overrides.
- Caching for performance: Results are cached for up to 7 days (for year) or 1 hour (for date) to ensure quick page loads.
- Easy language override: Use the lang attribute in the shortcode to specify the language you want.
How it Works and What to Expect
The Shortcode Year and Date plugin allows you to display dynamic, formatted date and year information with ordinal suffixes directly in your posts or pages. Simply use the provided shortcodes, and the plugin handles everything from calculating the current date to adding ordinal suffixes and caching the results.
- [ year ]
shortcode: Displays the current year in the format “2025” (with caching for performance). - [ date ] shortcode: Displays the current date with the correct ordinal suffix (e.g., “2nd April 2025” or “23rd March 2025”) based on your selected language.
- [ post-published ] shortcode: Displays the publish date of a post with ordinal suffixes.
Sample outputs:
- [ year ]: “2025”
- [ date ]: “1st January 2025” (English), “1° gennaio 2025” (Italian)
- [ post-published ]: “15th February 2023”
Performance Overview
Is it fast? Absolutely! The plugin caches the generated date and year results for up to 7 days (for the year) and 1 hour (for the date), which improves performance by avoiding redundant calculations. This ensures that your pages load quickly without putting unnecessary strain on your server.
Requirements & Compatibility
- WordPress 6.0+
- PHP 7.0+
- Works with WooCommerce, Custom Post Types, and Multilingual Plugins (WPML, Polylang)
- Caches results for performance optimization
Important note
Shortcodes are always written without spaces, like this: [word], not like this: [ word ]. In these descriptions, spaces are added only because the plugin is active on this website and writing the shortcode normally would display the date instead of showing the code.
Use Cases
The Shortcode Year and Date plugin isn’t just a small utility—it’s a real time-saver in places where you want your site to stay fresh without touching a thing.
Instead of editing the same details over and over, you can drop in a shortcode once and let the plugin keep things updated automatically.
It also shines when you need content in different languages. Whether you’re building a multilingual shop, running a blog, or maintaining legal pages, these shortcodes make sure dates look natural and correct for each locale.
Here are some common ways site owners put it to work:
- Evergreen footers without edits
Auto-update copyright lines site-wide: 2026 LitePlugin.com – All rights reserved. - Legal & policy pages
Stamp “Last updated” with locale-correct ordinals: Last updated: 17th October 2026. - Press releases & announcement blocks
Lock the publish date into layouts with 18th July 2025 so pages show a clean, human-readable format across languages. - Multilingual landing pages
Force a specific locale per block (useful for mixed-language sections or A/B tests):
Oferta válida hasta: [ date lang=”es_ES” ] • Gültig bis: [ date lang=”de_DE” ]. - Email templates & PDFs generated from WordPress
When builders pull shortcode content, dates render correctly with caching—no manual updates needed before exports. - Docs, changelogs, and knowledge bases
Show “Docs last reviewed: 17th October 2026” so readers always see up-to-date info. - Theme parts & block patterns
Drop 2026 in a global footer pattern once – every site using it stays correct automatically. - Client projects you rarely revisit
Ship a footer or meta block with shortcodes and forget it – cron + caching keeps it fresh and fast.
Shortcodes and Outputs
The plugin supports the following shortcodes with the language override via the lang attribute, which allows users to specify the language to use for the date formatting.
1. [ year ]
- Description: Displays the current year.
- Languages Supported: English (US & GB), Spanish, Italian, French, German.
- Sample Output:
- English (US & GB): “2025”
- Spanish (es_ES): “2025”
- Italian (it_IT): “2025”
- French (fr_FR): “2025”
- German (de_DE): “2025”
- Usage Example: [ year ]
- Attributes: lang=”en_US” (optional, overrides the default language).
- Example: [ year lang=”fr_FR” ] (Displays in French).
2. [ date ]
- Description: Displays the current date with ordinal suffixes (e.g., “2nd”, “23rd”) based on the selected language.
- Languages Supported: English (US & GB), Spanish, Italian, French, German.
- Sample Output (for 1st January 2025):
- English (US & GB): “1st January 2025”
- Spanish (es_ES): “1.º enero 2025”
- Italian (it_IT): “1° gennaio 2025”
- French (fr_FR): “1er janvier 2025”
- German (de_DE): “1. Januar 2025”
- Usage Example:
17th October 2026 - Attributes: lang=”en_US” (optional, overrides the default language).
- Example: [ date lang=”de_DE” ] (Displays in German).
3. [ post-published ]
- Description: Displays the publish date of a post with ordinal suffixes (e.g., “2nd”, “23rd”) based on the selected language.
- Languages Supported: English (US & GB), Spanish, Italian, French, German.
- Sample Output (for a post published on 15th February 2023):
- English (US & GB): “15th February 2023”
- Spanish (es_ES): “15.º febrero 2023”
- Italian (it_IT): “15° febbraio 2023”
- French (fr_FR): “15 février 2023”
- German (de_DE): “15. Februar 2023”
- Usage Example: [ post-published ]
- Attributes: lang=”en_US” (optional, overrides the default language).
- Example: [ post-published lang=”it_IT” ] (Displays in Italian).
Shortcode Variations with Language Overriding
For all shortcodes, the lang attribute can be used to override the default language and display the date or year in the specified language. Below are the possible languages you can use with the lang attribute:
- lang=”en_US” (English – US)
- lang=”en_GB” (English – UK)
- lang=”es_ES” (Spanish)
- lang=”it_IT” (Italian)
- lang=”fr_FR” (French)
- lang=”de_DE” (German)
Examples of Shortcode Usage with Language Override:
- [ year lang=”fr_FR” ] – Displays the current year in French (e.g., “2025”).
- [ date lang=”es_ES” ] – Displays the current date in Spanish (e.g., “1.º enero 2025”).
- [ post-published lang=”it_IT” ] – Displays the post published date in Italian (e.g., “15° febbraio 2023”).
License
The Post Time Ago is licensed under the Single Domain Licence:
- 1 license per domain.
- For more details, visit: LitePlugin License

