Support

Account

Home Forums Add-ons Repeater Field Get Post Featured Image and Content | New to ACF – Cant find the solution

Helping

Get Post Featured Image and Content | New to ACF – Cant find the solution

  • Hi!

    I am relatively new to ACF and I am trying to figure out the power of this tool. I am trying to solve something (that probably is easy for seasoned ACFers) that I cannot seem to find the solution for.

    I have a custom post type, “Members”. A member has a featured image and a introduction. I want to grab these two values and show them on the front page, where we can change the member from a dropdown in the back end.

    How can I create a dropdown for this and get the data I need?

    Example:
    This week “John Doe” is going to be featured on the front page. I go into the front page in the WordPress control panel and choose him, and update the page. Now John Doe’s image and introduction should show on the front page. Next week I’ll choose “Jane Doe”, and the same happens.

    FYI: I am using the Divi page builder, using the Dynamic Tags to retrieve the data from ACF.

    I hope that someone can push me in the right direction.

  • I am assuming here that you are using a post object field to select the member on the front page and that this field is returning a “Post Object”.

    
    // first you get the value of the field on the front page
    $member = get_field('featured_member');
    // then you get the fields from this members post by supplying the correct post ID
    $image = get_field('featured_image', $member->ID);
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.