Home › Forums › General Issues › Image Object and Image URL not working. › Reply To: Image Object and Image URL not working.
Thanks for the post.
For the Url return type, you can use the following code:
$home_banner = get_field('field_name', 123); // 123 is the post id that the field is listed in. <script>window.home_banner = “<?php echo $home_banner; ?>”;</script> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class=”banner”> <h1>Bringing nature to you <span>wherever you are</span></h1> </div>
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!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.