Home › Forums › General Issues › Link a field to a page or to a category › Reply To: Link a field to a page or to a category
Hi Pietro,
Yes… sorry to have thrown so many suggestions to you in my reply. I was just elaborating that there are plenty of choices.
I took another look at your site… and see where you have the code.
A simple approach would be to create a second field for the URL. This could be a text field or a URL field.
Here is how you could modify the code to include the second field’s value:
<?php if( get_field('paese', $this->post->ID) ) { ?>
<div class="block-left"><a href="<?php the_field('collegamento', $this->post->ID); ?>"><?php the_field('paese', $this->post->ID); ?></a></div>
<?php } ?>
I hope that’s helpful and gets you closer to your goal. Let me know!
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 excited to announce we've released Composer support for installing ACF PRO.
— Advanced Custom Fields (@wp_acf) January 31, 2023
π #ComposerPHP fans rejoice!
β¨ Please see the release post for all the details and full instructions. https://t.co/ebEfp61nlR
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.