| 开发者 | gauravtiwari |
|---|---|
| 更新时间 | 2026年1月25日 00:49 |
| 捐献地址: | 去捐款 |
| PHP版本: | 6.0 及以上 |
| WordPress版本: | 6.9 |
| 版权: | GPL-3.0-or-later |
| 版权网址: | 版权信息 |
[year] (current), [nyear] (next), [pyear] (previous)[month] (January), [mon] (Jan), [nmonth]/[pmonth] (next/previous)[date] (full date), [dt] (day number), [weekday] (day name)[age date="1990-05-15"] calculates years from any date[season] displays current season (supports hemispheres)[daysuntil date="2025-12-25"] and [dayssince date="2020-01-01"][datemodified] and [datepublished] shortcodes.[blackfriday] and [cybermonday] shortcodes.[season] shortcode. Supports hemisphere: [season region="south"] for Southern hemisphere.[age date="1990-05-15"] shortcode. Add ordinal suffix with ordinal="true" (e.g., "35th").[datemodified] and [datepublished] shortcodes.[blackfriday] and [cybermonday] shortcodes.[year] works as a replacement to %currentyear% , [month] as a replacement to %currentmonth% already./wp-content/plugins/ directory, or install the plugin through the WordPress plugins screen directly.If you are an affiliate marketer or blogger who uses months, years and dates in your posts. If you use this plugin to render dynamic month, year, date, next year, and previous year shortcodes, you won’t have to update those posts again and again as time passes.
You cannot. There is no options panel because there is no need to have one. Why bloat the WordPress dashboard with more options?
Like running text, you can use the shortcodes in both Block Editor and Classic Editor. You can also use the shortcodes in widget areas, including the footer (use-case: Autoupdating Copyright Year) and headers (use-case: Today’s Date).
Yes. The shortcode outputs are WPML ready and render as per the language set in your WordPress dashboard. Since there is no settings page, you don’t have to translate this plugin.
You can use <?php echo do_shortcode('[year]');?>, <?php echo do_shortcode('[month]');?> etc. in themes or in functionality plugins to use these shortcodes.
This plugin doesn’t render shortcodes in ACF fields by default (due to various reasons, security being the first). But if you really need to render [year] etc., shortcodes, you can enable selective rendering.
Just add this code in your theme’s functions.php file or in the Code Snippets plugin:
ACF field type => text
add_filter('acf/format_value/type=text', 'do_shortcode');
ACF field name => headline
add_filter('acf/format_value/name=headline', 'do_shortcode');
[season] shortcode to display current season (Spring, Summer, Fall, Winter)[season] - Northern hemisphere (default)[season region="south"] - Southern hemisphere (reversed seasons)[age] shortcode[age date="1990-05-15" ordinal="true"] - Returns "35th"[age date="1990-05-15" rank="true"] - Alias for ordinal[age] shortcode to calculate and display age from a birth date. Supports three formats:[age date="1990-05-15"] - Years only (e.g., "34")[age date="1990-05-15" format="ym"] - Years and months (e.g., "34 years, 7 months")[age date="1990-05-15" format="ymd"] - Full age (e.g., "34 years, 7 months, 12 days")[daysuntil] and [dayssince] countdown shortcodes for calculating days until/since a specific date.[datemodified] and post publication date: [datepublished]. Use these anywhere you want to make your site more dynamic and SEO friendly.[blackfriday] and [cybermonday] shortcodes render this years Black Fridy and Cyber Monday dates like November 25 and November 28. Couple these with [year] to make the dates complete. See this example[monthyear] no longer prints next month after 28th. Reason: User experience, as the user may be tricked to thinking the wrong current month and year names.[weekday] shortcode renders day of the week like Sunday, Monday, …[wd] shortcode renders shortnames for days of the week like Sun, Mon,…[monthyear] shortcode renders next month if the current month is about to end, after 28th every month.c before any month based shortcode to render it capitalized. Useful in various languages where Month names are generally in small letters, like French, Swedish etc.[cmonth], [cmon], [cnmonth], [cpmonth], [cnmon], [cpmon] etc.[nnyear] and [ppyear] show 2 years next and previous years, like 2023 and 2019 respectively.[monthyear] shows current month and year together for specific purposes.[mm] renders month number including trailing zero (01-12)[mn] renders month number without trailing zero (1-12)rank_math/paper/auto_generated_description/apply_shortcode filter that causes more load on sites, specially where wp_query is used.[dt] shortcode to render only the day of the month (like 1, 2, 3, 17, 28). Combine this with other shortcodes to create date formats you desire.[date] shortcode renders date as set by Dashboard -> Settings -> General -> Date.[mon] shortcode to render only the first three-letters of Month, like Jan, Feb, Mar, Apr etc.