Hi @James,
thank you for the answer. Until now i registered my API like that:
wp_register_script('google-maps', 'https://maps.googleapis.com/maps/api/js?key=MYAPIKEY');
wp_register_script('google-jsapi', 'https://www.google.com/jsapi');
wp_enqueue_script('google-maps');
wp_enqueue_script('google-jsapi');
Now i replaced that with your suggestion (iam using PRO):
function my_acf_init() {
acf_update_setting('google_api_key', 'MYAPIKEY');
}
add_action('acf/init', 'my_acf_init');
I didn’t test it on the online system yet, but on my localhost the frontend now only shows white. :/ Was there anything wrong about my old attempt, respectively what is the acf filter doing?
From https://www.advancedcustomfields.com/resources/query-posts-custom-fields/ 4. Sub custom field values i derived the following:
function my_posts_groupby() {
return '';
}
add_filter( 'posts_groupby', 'my_posts_groupby' );
function my_posts_where($where)
{
$where = str_replace("meta_key = 'daten_%_datum", "meta_key LIKE 'daten_%_datum", $where);
return $where;
}
add_filter('posts_where', 'my_posts_where');
// find todays date
$date = date('Ymd');
// args
$args = array(
'numberposts' => -1,
'post_type' => 'angebotecpt',
'meta_query' => array(
array(
'key' => 'daten_%_datum',
'compare' => '!=',
'value' => $date,
))
);
$query = new WP_Query($args);
Since i overwrite the my_posts_groupby filter i receive ALL posts (multiple occurence), which are NOT today for now. Thats pretty much what i wanted. But what iam still missing is how i can order those posts in my query for all those custom date fields.
Wanted result:
query order:
Event1:Yesterday
Event2:Tommorow
Event1:Day after tommorrow
and so on
I think i can use the orderby function for that. Any ideas?
Thank you! Exactly what i was looking for.