Beautiful UI.
Unfortunately whatever is plaguing my dev setup for the get_field functions – http://support.advancedcustomfields.com/forums/topic/cpt-loop-not-returning-get_field-but-does-get_post_meta/ – is also prohibiding the CodePress Admin Columns plugin from identifying my custom fields for selection.
But I will find a solution for that and then can see these both working very well together.
With all plugins except ACF deactivated I’ve also tried a very simple ACF field group attached to the standard post and get similar results when placing the get_field call in header.php.
Will create a fresh site shortly and follow-up if that does provide any difference in output.
The haystack gets a little smaller ;P
Either inside a loop or outside I run that snippet and get “bool(false)” as result with the admin bar and rest of page below where I put the snippet not displaying. If I remove the die; I get rest of page but same result.
All results from postid = 64 from postmeta table are screenshot to http://imgur.com/vKiw951 – It does not have a reference value in the table though the rest of the meta fields useful data is present.
Even doing the following direct call to a post ID that I know has data in my page template doesn’t work.
<?php echo get_field(‘highlight_call_to_action’, 64); ?>
Might it be related to the fact I’m using it assigned to a custom post type?
$post->ID does return value in the previous code yes. I tried with and without $post->ID appended to get_field call.
This page has a good summation of why I was using a separate WP_Query class object – http://www.binarymoon.co.uk/2010/03/5-wordpress-queryposts-tips/
Using a get_posts approach did not change the result but included for future reference anyone else – based closely off the example on get_posts template tag codex page.
$args = array( 'post_type' => 'highlight',
'posts_per_page'=> $count,
);
$highlights = get_posts( $args );
if (count($highlights)) {
$output = "<div id='highlights'><ul>";
foreach ( $highlights as $post ) : setup_postdata( $post );
$output .= "<li>";
$output .= get_field('highlight_call_to_action', $post->ID) . "<br/>";
$output .= get_field('highlight_call_to_action') . "<br/>";
$output .= get_post_meta($post->ID, "highlight_call_to_action", true) . "<br/>";
$output .= "</li>";
endforeach;
$output .= "</ul>";
wp_reset_postdata();
}
In either loop format case using get_field_object with / without the preceeding _ returns a blank shell response. Whether $post->ID is appended or not. Glad to have a temporary working solution, but would obviously prefer to make use of the ACF output fields as I get into more advanced uses with it.
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.