I'm not sure what I'm doing wrong here. I have a field called "grid_thumbnail" and a "related_projects" post_object. I am able to display the title of the related post. I just don't know how to get the Image URL of that related post. Suggestions?
<?php foreach(get_field('related_projects') as $post_object): ?>
<li>
<img src="<?php echo get_field('grid_thumbnail'); ?>"><br />
<a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID) ?></a>
</li>
Edit
print_r returns:
stdClass Object ( [ID] => 100
[post_author] => 1
[post_date] => 2012-01-12 05:11:25
[post_date_gmt] => 2012-01-12 05:11:25
[post_content] => Nulla facilisi. Pellentesque non tincidunt est. Nulla porta bibendum auctor. Proin feugiat eros bibendum lacus viverra fringilla ac id felis. Praesent a commodo leo. Phasellus et odio eget justo venenatis interdum at ut nulla. Praesent lacinia nulla eu libero tempus pulvinar. Sed elementum, nulla vitae imperdiet ornare, elit lorem vestibulum erat, ac aliquet purus lacus pharetra risus. Mauris facilisis volutpat odio a ultrices. Etiam nisl urna, mattis sed ultricies sit amet, euismod sit amet eros. Nam tempus erat ut ligula elementum cursus faucibus elit accumsan. Fusce rhoncus, nunc nec vestibulum facilisis, nibh leo vestibulum metus, vitae malesuada leo dui eu erat. Proin scelerisque, mi viverra dignissim porta, lectus justo pellentesque metus, at consequat ligula nulla eu ante. Fusce fringilla pretium venenatis. Quisque quis arcu porta dolor condimentum viverra at id augue. Donec pharetra venenatis felis.
[post_title] => Rada
[post_excerpt] =>
[post_status] => publish
[comment_status] => open
[ping_status] => open
[post_password] =>
[post_name] => rada-2
[to_ping] =>
[pinged] =>
[post_modified] => 2012-01-16 23:01:37
[post_modified_gmt] => 2012-01-16 23:01:37
[post_content_filtered] =>
[post_parent] => 0
[guid] => http://estevancarlos.kodingen.com/ecv7/?post_type=projects&p=100
[menu_order] => 0
[post_type] => projects
[post_mime_type] =>
[comment_count] => 0
[ancestors] => Array ( ) [filter] => raw )
print_r( $post_object )
give you? I have a feeling that$post_object
is not a post object...get_field()
, either that or you're having a variable name conflict with$post_object
.get_field()
is not a wordpress core function, where is that function coming from?$post_object->title
? Are you just looking for the filters? Also, is the permalink working and just the title's broken?