| 开发者 | texlab |
|---|---|
| 更新时间 | 2026年9月12日 13:20 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[texlab_current_year] to display the current year[texlab_current_year] anywhere in your posts, pages, or widgets where you want the current year to appear.
Example usage in a copyright notice:
© [texlab_current_year] Your Company Name. All rights reserved.
Developers
The rendered year can be adjusted with the texlab_current_year filter:
add_filter( 'texlab_current_year', function ( $year ) { return $year; } );
GitHub repository: Texlab Current Year on GitHub
/wp-content/plugins/texlab-current-year directory, or install the plugin through the WordPress plugins screen directly.[texlab_current_year] in your contentSimply insert the shortcode [texlab_current_year] wherever you want the current year to appear.
No. The plugin registers a single shortcode and loads no scripts, styles or settings. It performs no database queries.
Yes, you can use the shortcode in template files by using the do_shortcode() function:
<?php echo do_shortcode('[texlab_current_year]'); ?>
The year is generated with wp_date(), which uses the timezone set in Settings > General.
No. The shortcode outputs the year in YYYY format only. Developers who need something else can use the texlab_current_year filter.
wp_date() so it respects the timezone configured in Settings > General instead of the server timezone.flush_rewrite_rules(). The plugin registers no rewrite rules, so the call was unnecessary work on every activation.load_plugin_textdomain() call. WordPress.org has served plugin translations automatically since WordPress 4.6.init hook, as recommended.texlab_current_year filter for developers.