Home › Forums › Front-end Issues › CPT and ACF › Reply To: CPT and ACF
Hi @crlannen
I believe you can use this code:
<?php
$posts = get_field('project_client');
$projectUrl = get_field('project_url');
if( $posts ): ?>
<?php foreach( $posts as $post): ?>
<?php setup_postdata($post); ?>
<div class="client-name"><a href="<?php echo $projectUrl; ?>"><?php the_field('client_name'); ?></a>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
If it isn’t working, could you please share the JSON export file of your field group?
Thanks!
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.