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:41 pm
#32550
Keymaster
Try this variation, 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' );
$r->image = wp_get_attachment_image_src(
$vendor->avatar,
apply_filters( 'yith_wcmv_get_avatar_size', YITH_Vendors()->get_image_size( 'gravatar' ) )
);
}
}
return $results;
}