Home › Forums › General Issues › Image URL not working
Hello there!
I need help with a “Team” page that is a parent to individual bio pages for team members. ACFs are added and working perfectly for the individual bio pages to get fields for name, job title, bio, image, etc. The “Team” page is using the following code to pull select ACF fields for each team member from their bio page. All fields are working except the image which is set to return an image array but is currently a broken image icon on the page.
<?php $pages = get_pages( array( 'child_of' => '665' ) );
foreach ($pages as $page_data) {
$content = apply_filters('the_content', $page_data->post_content);
$title = $page_data->post_title;
$slug = $page_data->post_name;
$imgUrl = $page_data->team_member_image;
$jobTitle = $page_data->job_title;
$teaser = $page_data->teaser_text;
?>
<div class='col-xs-12 col-sm-6 col-md-3' style='text-align: center;'>
<a href="/team/<?php echo $slug; ?>">
<img src="/<?php echo $imgUrl['url']; ?>" />
<h2><?php echo $title; ?></h2>
<h3><?php echo $jobTitle; ?></h3>
<span><?php echo $teaser; ?></span>
</a>
</div>
<?php
}
?>
In doing a var_dump() for the $image OR $team_member_image variables they return NULL. Doing the same for $page_data->team_member_image; returns image array ID numbers related to each bio. Is there a way to get the full image path using the get_pages approach I’m using?
Thanks for your time and consideration!

I don’t know how any of these are returning anything unless there is more code involved than you are posting
$imgUrl = $page_data->team_member_image;
$jobTitle = $page_data->job_title;
$teaser = $page_data->teaser_text;
These should look something like this
$imgUrl = get_field('team_member_image', $page_data->ID);
$jobTitle = get_field('job_title', $page_data->ID);
$teaser = get_field('teaser_text', $page_data->ID);
The topic ‘Image URL not working’ is closed to new replies.
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.