Home › Forums › General Issues › Show Custom Field results from one post type in template of another › Reply To: Show Custom Field results from one post type in template of another
Hi @andisaleh and @elliot
I feel this is getting closer but still can’t work out why such a simple task of grabbing one value from another post and matching it to current post is so hard. I am going crazy! haha.
New query is now this, but unfortunately it returns nothing.
<?php
$args = array(
'numberposts'=> -1, // Fetch all posts...
'post_type'=> 'release', // from the 'release' CPT...
'meta_key' => 'artist_name', // which inside this meta key...
'meta_value' => get_the_ID(), // has this meta value.
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) :
echo '<ul>';
while ($my_query->have_posts()) : $my_query->the_post();
?>
<li>
<img src="<?php the_field('cover_image'); ?>" />
<?php the_field('artist_name'); ?>
<?php the_title(); ?>
</li>
<?php
endwhile; echo '</ul>';
endif; wp_reset_query(); ?>
Failing this – do either of you know any quick places I can go to pay someone to do this? I just don’t have any contacts in that regard.
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.