Thursday, July 20, 2023

How to show the current year in WordPress posts

Add this function in the functions.php file.

function current_year() {
    $year = date('Y');
    return $year;
}

add_shortcode('year', 'current_year');

No comments:

Post a Comment

Yoast SEO — Simple Guide

  7 Yoast SEO is one of the most popular WordPress plugins used to optimize your website for search engines (Google) without needing deep ...