Home › Forums › Add-ons › Gallery Field › Include Gallery Field in Custom Post Type › Reply To: Include Gallery Field in Custom Post Type
Elliot:
I did try code from that page before posting the question. I’m a front end guy that dabbles with PHP just enough to do my WordPress sites. Your ACF has been a life saver for those like me.
Anyway… if you can just show me how to include a gallery in a custom post type that would rock. For example, let’s just say the custom post type was only pulling in the ACF gallery (to make it easy) – below is how I’d pull in a normal ACF field in a CPT:
<?php
$loop = new WP_Query( array( 'post_type' => 'cars', 'posts_per_page' => 10 ) );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<img src="';
the_field('images');
echo '">';
endwhile;
?>
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.