Skip to content

Instantly share code, notes, and snippets.

@asathoor
Created December 8, 2013 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asathoor/7863313 to your computer and use it in GitHub Desktop.
Save asathoor/7863313 to your computer and use it in GitHub Desktop.
Add the current year to a post or page in WordPress by the shortcode [anno]
<?php
/**
* Plugin Name: Write the year by the shortcode 'anno'
* Plugin URI: http://www.multimusen.dk
* Description: IAITS.
* Version: 1.0
* Author: Per Thykjaer Jensen (inspired by the link below)
* Author URI: http://www.multimusen.dk
* License: (c) 2013 GPLv3
* Insert the current year by a shortcode
* Inspired by: http://wordpress.org/support/topic/creating-a-year-shortcode
**/
function year_shortcode() {
$year = date('Y');
return $year;
}
add_shortcode('anno', 'year_shortcode');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment