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’re hard at work on ACF 6.1, and Beta 1 is now available 🚀— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.