Last active
June 21, 2016 14:40
-
-
Save robertpassaro/3cdb790f028497615512 to your computer and use it in GitHub Desktop.
Template tag that echoes html output for a copyright string on the page; includes option to have a "starting year" as well as the 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
/* | |
* Dynamic copyright date | |
* | |
* Template tag that echoes html for a copyright string to the page; | |
* includes option to have a "starting year" as well as the current year. | |
* | |
* @param (string) $organization Optional. Name of the company or organization that holds the copyright to site content. Defaults to site title. | |
* @param (string) $launch_year Optional. The year the site was launched. | |
* | |
* Example: the_copyright_statement( 'Figoli Quinn & Associates', '2014' ); | |
* will render on the page: © 2014-2016 Figoli Quinn & Associates | |
*/ | |
function the_copyright_statement( $organization = '', $launch_year = '' ) { | |
if( empty( $organization ) ) { | |
$organization = get_bloginfo( 'name' ); | |
} | |
$current_year = date( 'Y' ); | |
if( empty( $launch_year ) || $current_year == $launch_year ) { | |
$copyright_date = $current_year; | |
} else { | |
$copyright_date = $launch_year . "-" . $current_year; | |
} | |
echo '<p class="copyright-statement">©' . ' ' . $copyright_date . ' ' . $organization . ' | All rights reserved</p>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment