ACF Pro Accessing fields on a Custom Post Type


I’m an intermediate PHP user and I’ve been able to do some great things on my own with ACF but I could use some help. Instead of using an options page, I would like to add some fields to the Custom Post Type I’ve created -> Team Members. For now I would just like have an image field that will be used on the archive page. I will be using the Archive page archive-team_members to display all the members. I’m having trouble pulling this image field into the archive template. I’m not sure how to specify the top level of Team Members as the source of the field. Using this page as reference I attempted to use the following, but the image url displays empty.

        $term = get_queried_object();

        $image = get_field('team_members_page_image', $term);

<div class="post-hero-image archive-header" style="background-image: url('<?php echo $image ?>')">

Can anyone lead me in the right direction here? Or is making a Team Members Option page the best way to go about doing this. Thank you very much.


, , , David 4 years 2019-11-05T21:54:07-05:00 0 Answers 79 views 0

Leave an answer