Advanced Custom Fields – Google Map Won’t Render Unless Variable Dumped

Try this code: <div class=”map”> <?php global $post; $location = get_field(‘location’, $post->ID); ?> <div class=”acf-map”> <div class=”marker” data-lat=”<?php echo $location[‘lat’]; ?>” data-lng=”<?php echo $location[‘lng’]; ?>”></div> </div> </div> Sometimes in the template you’re loading this you don’t have the post that the field belongs to, so you can try to fetch it in the global $post … Read more

Position a repeated article blocks

Your is_int function is always returning true, because $count/2 is always an integer. is_int from the looks of it, just returns true if the parameter supplied is a number (integer), or false, if its anything else (string). Try changing if(is_int($count / 2)){ … } to if($count % 2 == 0) { //Code for even result … Read more

ACF Post Content Not Being Searched

Advanced Custom Fields does not automatically output the fields you add in the_content(). You need to use ACF’s template functions. Refer to the documentation for more. Based on your comment, yours will look something like: <div class=”contentarea”> <div id=”content” class=”content_right”> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div id=”post-<?php … Read more

ACF order relationship by date

The $journalEntries IDs are a post_type = post? Because if you don’t specify the post_type in the WP_Query it will default to ‘post’. So your $args array should be: $args = array( ‘post_type’ => ‘put_post_type_here’, ‘post__in’ => $journalEntries, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, );

save_post affect creation and deletion

There are something wrong in your code, Here I edited what you tried, function rohs_update_title($post_ID){ $post_type = get_post_type($post_ID); // If this isn’t a ‘rohs_menu’ post, don’t update it. if ( “rohs_menu” != $post_type ) return; $postAuthorId = get_post_field( ‘post_author’, $post_ID ); // get the post author ID $userToGetData=”user_”.$postAuthorId; $restaurantName = get_field( ‘nom_restaurant’, $userToGetData ); $date … Read more