Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › How to add image source into a custom field? › Reply To: How to add image source into a custom field?
April 3, 2021 at 12:54 pm
#32553
Keymaster
Tough one, maybe this one:
add_filter('asp_results', 'asp_results_add_custom_image', 10, 1);
function asp_results_add_custom_image($results) {
foreach ( $results as $k => &$r ) {
if ( isset($r->taxonomy) ) {
$vendor = yith_get_vendor( $r->id, 'vendor' );
$im = wp_get_attachment_image_src(
$vendor->avatar,
apply_filters( 'yith_wcmv_get_avatar_size', YITH_Vendors()->get_image_size( 'gravatar' ) )
);
$r->image = isset($im[0]) ? $im[0] : $r->image;
}
}
return $results;
}
If this does not work, then I don’t know what the issue could be.