Created
April 4, 2015 20:03
-
-
Save schlessera/31484857a40340b4682d to your computer and use it in GitHub Desktop.
Shortcode to display copyright notice with current year
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 | |
/** | |
* Shortcode to display copyright notice with current year | |
* @author Alain Schlesser (alain.schlesser@gmail.com) | |
*/ | |
function as_shortcode_copyright() { | |
// generate output in the form of "(C) 2015 Greatest Blog Ever" | |
$copyright = '© ' . date( 'Y' ) . ' ' . get_bloginfo( 'name' ); | |
return $copyright; | |
} | |
// register as shortcode [copyright] | |
add_shortcode( 'copyright', 'as_shortcode_copyright' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't print the current year as copyright date. Here is an explanation why:
https://stackoverflow.com/a/2391555