Reply To: Image in search box not showing

#2994
Ernest Marcinko
Ernest Marcinko
Keymaster

I just chekced on your backend, and the custom field does not contain the url, but a number. Here you can see it: https://i.imgur.com/PyfSLgm.png

And that’s what is visible on the frontend as well. Normally I can’t offer 3rd party plugin support, but in this case I can probably help you to get around this.

It looks like that the number is actually the ID of the image, that has been uploaded. There is a filtering function available for the image manipulation for ajax search pro. Try to copy this code into your theme’s functions.php file:


add_filter( "asp_result_image_after_prostproc", "asp_cf_image", 1, 1 );
 
function asp_cf_image( $image ) {
  if ($image != "" && strlen($image) < 10) {
    $atts = wp_get_attachment_image_src( $image );
    if (isset($atts[0]))
      return $atts[0];
    return null;
  }
  return $image;
}

I’m not sure if it will help, but it’s worth a try.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)