ACF: Querying relationship fields with Author

The users doesn’t have permalinks nor titles. They have author links and display names. Changed the code: <?php while ( have_posts() ) : the_post(); ?> <h2>Resturants</h2> <?php $resturants = get_users(array( // Changed from get_posts ‘fields’ => ‘all_with_meta’, // All with meta to get also display_name ‘meta_query’ => array( array( ‘key’ => ‘resturant’, // name of … Read more

Hide ACF from source code until a “show” button is clicked

You’re going to need to $.ajax() the contents of the field(s) on a click. In a nutshell: In your page template <?php global $post; $post_id = $post->ID; ?> <button class=”acf-get-content-button”>Let’s see that content</button> <div id=”acf-content-wrapper” data-id=”<?php echo $post_id; ?>”></div> JS (function($) { $(‘.acf-get-content-button’).click(function(e){ e.preventDefault(); var $contentWrapper = $( ‘#acf-content-wrapper’ ); var postId = $contentWrapper.data( ‘id’ … Read more

Not displaying posts that are in the past. ACF date > date

You seem to be missing the meta_query proprety and looking at your code you seem to have two meta values mixed, so we need to combine them. $loop = new WP_Query([ ‘category_name’ => ‘gold’, ‘orderby’ => ‘rand’, ‘posts_per_page’ => -1, ‘meta_query’ => [ ‘relation’ => ‘and’, [ ‘key’ => ‘status’, ‘value’ => ‘active’ ], [ … Read more