How to Create a Year Shortcode in WordPress

x theme
(Last Updated On: July 10, 2014)

Following is a beautiful tip for creating a WordPress year shortcode. After creating this year shortcode, you can use that shortcode anywhere in your WordPress website. The shortcode will display current year dynamically. Paste the following code snippet in your functions.php file.

function shortcode_for_year() {
$year = date('Y');
return $year;
}
add_shortcode('the_year', 'shortcode_for_year');

Related posts:

About the author

admin

Leave a Reply

Your email address will not be published. Required fields are marked *