-
-
Save hiiightower/d45532e40c6ee2ade33373ed82df20ee to your computer and use it in GitHub Desktop.
reverse lookup acf relationship field and passing variable in template part
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$auctionend=''; | |
$args = array( | |
'post_type' => 'auction', | |
'meta_query' => array( | |
array( | |
'key' => 'connect_property_single', | |
'value' => '"'. get_the_ID() .'"', | |
'compare' => 'LIKE' | |
) | |
) | |
); | |
$loop = new WP_Query($args); | |
if($loop->have_posts()) : | |
while($loop->have_posts()) : $loop->the_post(); | |
$auctionend = get_field( 'auction_end' ); | |
endwhile; | |
endif; | |
wp_reset_query(); | |
?> | |
<section class="container-fluid" id="section7"> | |
<div class="container"> | |
<div class="row"> | |
<?php set_query_var( 'auctionend', $auctionend ); ?> | |
<?php get_template_part( 'content/content', 'property' ); ?> | |
</div> | |
</div> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment