I’m not sure how far you’ve got with this but this works for me.
acf.add_action('google_map_init', function( map, marker, $field ){
// map (object) google map object returned by the google.maps.Map() function
// marker (object) marker object returned by the google.maps.Marker() function
// $field (jQuery) field element
var autocomplete = new google.maps.places.Autocomplete( $field.find('.search')[0] );
autocomplete.addListener('place_changed', function(e) {
var place = autocomplete.getPlace();
// your code here...
});
});
Could you post your filter code that you’re hooking into acf/save_post
?
You could wrap it in an if
statement to check if $projects
is empty.
<?php
$projects = get_field('projects');
if ( $projects ) :
?>
<h2>Supported projects</h2>
<hr class=”bg__yellow”>
<div class="posts">
<?php foreach( $projects as $post) : setup_postdata($post); ?>
// Your code here...
<?php endforeach; wp_reset_postdata(); ?>
</div>
<?php endif; ?>
Try moving your wp_reset_postdata()
calls inside your if($query->have_posts())
and if($postsQuery->have_posts())
statements.
https://developer.wordpress.org/reference/functions/wp_reset_postdata/#comment-2325
Could you post the code you’re using to display the home page content and the new field you created?
You would need to hook into the “acf/save_post” action and create the title of the post from the custom Google map field data.
https://www.advancedcustomfields.com/resources/acf-save_post/
Have you tried debugging this by removing the “tax_query” and then removing the “meta_key” and “orderby” to see if the query is returning all the properties you’re expecting?
This should help push you in the right direction.
https://www.advancedcustomfields.com/resources/query-posts-custom-fields/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.