Home › Forums › ACF PRO › Relationship from a custom post types › Reply To: Relationship from a custom post types
if you’re trying to get the images from the related posts then you need to get those fields inside of the loop for those posts
//homepage
<?php
$posts = get_field('correlati_vini');
if( $posts ): ?>
<div class="wine-list">
<div class="row row-news ">
<?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
<?php
setup_postdata($post);
$image = get_field('copertina_libro');
$correlata = get_field('copertina_libro_correlata');
$size = 'thumbs-liste'; // (utilizzo la mia dimensione personalizzata)
$sizefull = 'full'; // (utilizzo la dimensione originale)
?>
<div class="col-md-4">
<div class="featured-image">
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><img class="img-responsive" src="<?php echo wp_get_attachment_image( $image, $size ); ?>" /></a>
</div>
.....
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.