I have a date of updated posts $date
which is printing the date as "November 3, 2018"
And I have a widget that should be shown only if the date is before October 29, 2018
I thave ried something like this for example:
$date = get_the_time( 'F j, Y', $ID );
$deadline = strtotime('2018-10-29');
if ($date > $deadline) {
echo 'Yes';
} else {
echo 'No';
}
you have to format the date as "Y-m-d" so :
$date = get_the_time( "Y-m-d");
//var_dump( strtotime($date));
$deadline = strtotime('2010-09-29');
//var_dump( $deadline);
if (strtotime($date) > $deadline) {
echo 'Yes';
} else {
echo 'No';
}