Looking for some guidance/direction both to reframe/improve this question and get to a place where I can
Display a Category Featured Image (ACF Field) INSIDE a Post (above the content).
I’m using ACF Pro(not sure if I’m logged in to the correct account here in the forum), and doing work on a Divi Theme, prefer to get this in a code module or better yet, Dynamically hit the ACF Field from a module.
Here’s where I think I am headed… about to go test a bit. Feel like I am missing something. This was inspired by multiple bits of documentation plus this post from 2019 w John’s reply
<?php
$categories= get_the_category();
if (!empty($categories)) {
$term_id = $categories[0]->term_id;
$image = get_field('category_logo_version_2', 'term_'.$term_id);
// what you do from here depends on what the field is returning
}
?>
// my educated guess at what I need to do next
<?php if( get_field('category_logo_version_2') ): ?>
// ACF is set to return the URL for this field thus no need for ['url'] before semicolon
<img class='center-image-w-css-later' src="<?php the_field('category_logo_version_2'); ?>" />
<?php endif; ?>