update the year

javascript tips

so, another year has come and you want the current year to reflect on your website, but you don’t want to have to go through the process. there’s an easy fix to have your site update automatically. the script is below.

for a php site, like WordPress, go to the file named functions.php and copy and paste the following code

function year_short() {

$year = date('Y');

return $year;

}

add_shortcode('year', 'year_short');