Home › Forums › Bug Reports › image field doesn't return image url › Reply To: image field doesn't return image url
Hi @elliot.
Sorry my bad.
That was some older code. I did in fact use a img tag but to no success.
<?php $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?>
<?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
<li>
<a href="<?php echo get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>">
<div class="subdivision">
<?php
if (get_field('sub_division_image')){ ?>
<img src="<?php the_field('sub_division_image'); ?>" alt="<?php echo $pageChild->post_title; ?>" />
<?php } else {
echo "Hello world";
} ?>
</div>
<p><?php echo $pageChild->post_title; ?></p>
</a>
</li>
<?php endforeach; endif; ?>
Any thoughts?
Cheers,
GM
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.