Home › Forums › General Issues › Replace Featured Image in Search Results with ACF Image? › Reply To: Replace Featured Image in Search Results with ACF Image?
Hi John – Perhaps this will help us. I really appreciate anything you can do to help.
I’m using relavennsi and found this discussion where ACF support assisted people in getting something very similar to work. Does this info help at all?
https://www.relevanssi.com/knowledge-base/add-custom-fields-search-excerpts/
Using the filter supplied by Relavenssi, I entered my custom field names, but the images don’t display:
add_filter(‘relevanssi_excerpt_content’, ‘custom_fields_to_excerpts’, 10, 3);
function custom_fields_to_excerpts($content, $post, $query) {
$custom_field = get_post_meta($post->ID, ‘add_image_search_results‘, true);
$content .= ” ” . $custom_field;
$custom_field = get_post_meta($post->ID, ‘wh1‘, true);
$content .= ” ” . $custom_field;
return $content;
}
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.