Home / Admin / Dynamic Current Year
Duplicate Snippet

Embed Snippet on Your Site

Dynamic Current Year

The shortcode prints out dynamic current year wherever used [current_year] in the frontend layout, e.g. 2020 to 2025 > 2020 to [current_year]. There are many variations.

Code Preview
php
<?php
// Dynamic Current Year / Kiri Vadivelu / 2026
function current_year() {
    $year = date('Y');
    return $year;
}
add_shortcode('current_year', 'current_year');   

Comments

Add a Comment