0

Say I have an acf called "show_this_tomorrow" every day (in a new post) I put some data into the field. And I want to show that data output on the next days post. I was thinking I'd use this to grab it, but it doesn't work in or outside the loop -

<p><?php echo get_post_meta( $prev_post->ID, 'show_this_tomorrow', true); ?></p>
1
  • how do you set $prev_post?
    – Milo
    Jan 21, 2015 at 16:25

1 Answer 1

0

While fetching the custom fields details added using ACF, you need to use the functions from the plugin.

Use the_field to echo the value and get_field to retrieve the value.

Here you can use

<p><?php echo get_field( 'show_this_tomorrow', $prev_post->ID ); ?></p>

or

<p><?php the_field( 'show_this_tomorrow', $prev_post->ID ); ?></p>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.