Created
November 15, 2013 00:45
-
-
Save barbwiredmedia/7477228 to your computer and use it in GitHub Desktop.
Wordpress Working with time datepicker in javascript and ACF meta date. Reformat time for use by persons and show different content depending on if the date has passed.
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 | |
// http://php.net/manual/en/function.date.php | |
//get the time from the ACF time picker see php.net for date formats | |
$printdate = DateTime::createFromFormat('Ymd', get_post_meta($post->ID, 'event_date', 'true')); //event_date from custom feild | |
$eventDate = $printdate->format('m/d/Y'); | |
if (time() < strtotime("$eventDate 11:59PM")) { ?> | |
<!-- the date has not passed SHOW CONTENT --> | |
<?php } else { ?> | |
<!-- SORRY the date has passed already--> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment