Created
December 8, 2013 20:18
-
-
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]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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