Exclude posts by date – related post
Exclude posts by date – related post
Exclude posts by date – related post
Using query_posts is pretty much always a bad idea as it causes another database query but it also will break pagination and can cause other issues as well. What you need it a filter on pre_get_posts. function pgp($qry) { if (!is_admin() && is_main_query() && $qry->is_category(3709)) { $qry->set(‘orderby’,’meta_value’); $qry->set(‘meta_key’,’Deadline’); //formatted YYYYMMDD $qry->set(‘ignore_sticky_posts’,true); } return $qry; } … Read more
WP_Query() displaying past post / event
Dynamically update Custom Fields to display new dates
Order Wp Query by earliest of 3 dates meta query
There’s no native “Time Interval” field type in ACF, but you could: Use a third-party custom field like the “Date Range Picker” provided by ACF Extended (it’s a commercial plugin that adds features to ACF). Use 2 distinct native Date Picker fields for “from” and “to”, possibly inserted inside a Group. You may take advantage … Read more
Assuming you know the post ID for the specific post/type it’s easy enough yes, simply call get_the_date() with a specific ID. Adjust 1 to the appropriate value. <?php echo get_the_date( ”, 1 ); ?>
Get posts that were most recently tagged
date_default_timezone_set can alter the output of a new DateTime. Not sure how it will affect get_the_time. $date = new DateTime( get_the_time(‘c’) ); $date->setTimezone(new DateTimeZone(‘Europe/Warsaw’)); echo $date->format(‘c’); $date = new DateTime(); echo $date->format(‘c’); // 2015-12-18T18:21:31+00:00 $date->setTimezone(new DateTimeZone(‘Europe/Warsaw’)); echo $date->format(‘c’); // 2015-12-18T19:21:31+01:00 date_default_timezone_set(‘Europe/Warsaw’); $date = new DateTime(); echo $date->format(‘c’); // 2015-12-18T19:21:31+01:00
This doesn’t have anything to do with WordPress, just some PHP code to get what you’re after. You need to convert MySQL datetime to Unix time by using: $timestamp = strtotime($psm_mod_datetime); Then you output this timestamp in the format you desire by using: echo “Updated: “.date(‘d F Y’, $timestamp);