説明
Texlab Current Year is a lightweight WordPress plugin that allows you to display the current year anywhere on your website using a simple shortcode. This is particularly useful for copyright notices and other date-sensitive content that needs to be automatically updated each year.
The year is calculated from the timezone configured in Settings > General, so it rolls over at midnight for your site rather than for the server.
Features
- Simple shortcode
[texlab_current_year]to display the current year - Uses the site’s configured timezone
- Lightweight and efficient: no options, no database queries, no assets loaded
- No configuration needed
- Works with any theme
- Perfect for footer copyright notices
Usage
Simply insert the shortcode [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
Additional Info
For more information and support, please visit:
Texlab IT
インストール
- Upload the plugin files to the
/wp-content/plugins/texlab-current-yeardirectory, or install the plugin through the WordPress plugins screen directly. - Activate the plugin through the ‘Plugins’ screen in WordPress
- Use the shortcode
[texlab_current_year]in your content
FAQ
-
How do I use this plugin?
-
Simply insert the shortcode
[texlab_current_year]wherever you want the current year to appear. -
Does this plugin slow down my website?
-
No. The plugin registers a single shortcode and loads no scripts, styles or settings. It performs no database queries.
-
Can I use this in my theme’s template files?
-
Yes, you can use the shortcode in template files by using the
do_shortcode()function: -
Which timezone is the year based on?
-
The year is generated with
wp_date(), which uses the timezone set in Settings > General. -
Does it support different date formats?
-
No. The shortcode outputs the year in YYYY format only. Developers who need something else can use the
texlab_current_yearfilter.
貢献者と開発者
“Texlab Current Year” をあなたの言語に翻訳しましょう。
開発に興味がありますか ?
変更履歴
1.2.0
- Tested with WordPress 7.1.
- Raised the minimum supported versions to WordPress 6.5 and PHP 7.4, as PHP 7.2 and 7.3 no longer receive security fixes.
- The year is now generated with
wp_date()so it respects the timezone configured in Settings > General instead of the server timezone. - The shortcode callback now explicitly discards any attributes passed to it, so no author-supplied value can reach the output.
- Removed the activation and deactivation hooks that called
flush_rewrite_rules(). The plugin registers no rewrite rules, so the call was unnecessary work on every activation. - Removed the unused plugin path and URL constants from the global namespace.
- Removed the redundant
load_plugin_textdomain()call. WordPress.org has served plugin translations automatically since WordPress 4.6. - The shortcode is now registered on the
inithook, as recommended. - Added a
texlab_current_yearfilter for developers.
1.1.0
- Added proper class-based structure
- Improved code organization and documentation
- Added internationalization support
- Added activation and deactivation hooks
- Enhanced security measures
1.0.0
- Initial release