Created
February 25, 2017 13:12
-
-
Save lynt-smitka/8db9b3c416b1ae6c7cde3774b5afea47 to your computer and use it in GitHub Desktop.
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
function lynt_date_shortcode( $atts , $content = null ) { | |
$atts = shortcode_atts( | |
array( | |
'den' => 0, | |
'start' => '', | |
'stop' => '', | |
), | |
$atts,'lynt_date'); | |
$den = intval($atts["den"]); | |
$start = strtotime($atts["start"]); | |
$stop = strtotime($atts["stop"]); | |
$ted = time(); | |
if($ted > $start && $ted < $stop && intval(date('N',$ted)) === $den) { | |
return $content; | |
} | |
} | |
add_shortcode( 'lynt_date', 'lynt_date_shortcode' ); | |
//[lynt_date den="5" start="17:30" stop="21:00"]TEXT[/lynt_date] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment