Compare WP Custom Field date

Take a look at meta.php:777: … CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$meta_compare_string})… So if you want to use DATE comparisons, you should use MySQL compatible date formats (YYYY-MM-DD). Change this part of your code: array( ‘key’ => ‘date’, ‘value’ => date(“Y/m/d”), ‘compare’ => ‘>=’, ‘type’ => ‘DATE’ ), to: array( ‘key’ => ‘date’, ‘value’ => date(“Y-m-d”), … Read more

Styling the date format with date_i18n

Just use date_i18n in multiple places with PHP date arguments just for what you need: if ( $date = get_post_meta( $thepostid, ‘_sale_price_dates_to’, true ) ) { $sale_price_dates_to = ‘<span class=”m”>’ . date_i18n( ‘M’, $date ) . ‘</span> ‘ . ‘<span class=”d”>’ . date_i18n( ‘j’, $date ) . ‘</span> ‘ . ‘<span class=”y”>’ . date_i18n( ‘Y’, … Read more