Reputation: 384
I have this query -
<?php if (has_term( 'channel', 'listing_area' )) { ?>
<?php
$posts = get_posts(array(
'numberposts' => 3,
'post_type' => 'adverts',
'order_by' => 'title',
'order' => 'random',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'associate_adverts',
'value' => '1822',
'compare' => 'LIKE',
)
),
));
?>
<?php //if it's returning the object
foreach($posts as $advert){
$img = get_field("advert", $advert->id);?>
<img src="<?php echo $img["url"]; ?>"/>
<?php }?>
I need to show an image called from an advanced custom field called 'advert' which is set to use the image array option where I'm calling the post title.
How can I do this? Thanks.
Upvotes: 2
Views: 6510