Created
July 8, 2012 12:21
-
-
Save carstingaxion/3070690 to your computer and use it in GitHub Desktop.
Countdown Shortcode for WordPress
This file contains hidden or 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 | |
function countdown_shortcode ( $atts ) { | |
extract( shortcode_atts( array( | |
'date' => '', | |
), $atts ) ); | |
if ( !isset($date) ) | |
return false; | |
return '<span class="countdown">'.floor( ( strtotime( $date ) - time() )/60/60/24 ).'</span>'; | |
} | |
add_shortcode( 'countdown', 'countdown_shortcode' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment