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
This is the code I use to display ALL of the releases. It works great.
I need to somehow adapt this query to show only the Releases of a specific artist on their Artist page. Thought it might help…
<?php
$args=array(
'post_type' => 'book',
'post_status' => 'publish',
'posts_per_page' => 12,
'caller_get_posts'=> 1,
'orderby'=> 'date',
'order' => 'DESC'
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo '';
$i = 0;
while ($my_query->have_posts()) : $my_query->the_post();
if($i % 6 == 0) { ?>
<div class="row">
<?php
}
?>
<img src="<?php the_field('cover_image'); ?>" /><br />
<?php the_field('author_name'); ?><br />
<?php the_title(); ?><br />
</div>
<?php
if($i % 6 == 0) { ?>
<?php
}
$i++;
endwhile;
}
wp_reset_query();
?>
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.