I have custom post metadata with the name acnb_live_date. I want to use WP Show Posts to retrieve a post list based on a comparison between acnb-live_date and (now)+ nS. The code I need to execute would be something like this. I lack sufficient understanding of the Loop to work out where I need to run it. Ideally I’d like it only to run when the show posts function runs, but if I could handle it being a site wide thing.
$acnb_live_date = get_post_meta( get_the_ID (), ‘acnb_live_date’, true);
if (isset($acnb_live_date)){
$compare_date = new \DateTime(); //now
$compare_date->add(new \DateInterval(‘PT3600S’));//add 3600s / 1
$cc_args = array(
‘posts_per_page’ => -1,
‘post_type’ => ‘post’,
‘meta_key’ => ‘acnb_live_date’,
‘value’ => date(“Y-m-d”)
‘compare’ => ‘>= compare_date’
‘type’ => ‘date’
);
$cc_query = new WP_Query( $cc_args );
}
THank you so much for your continuing development of these project. They are powerful and helpful.