• Resolved JohnAndDeanna

    (@johnanddeanna)


    http://www.testing.wilhelmschweizer.com
    This is an e-commerce site, using exchange from ithemes.
    The search works but the image that is shown in the search return is most often a darken WordPress logo rather than the product image. Occasionally a screen shot of the page comes up.
    My image source settings (below) are probably wrong primarily because I don’t really know what they should be.

    Primary image source – Featured Image
    Alternative image source 1 – Custom Field
    Alternative image source 2 – Post Content
    Alternative image source 3 – Post Excerpt
    Alternative image source 4 – Page Screenshot

    Help would be greatly appreciated.

    Regards,
    John

    https://wordpress.org/plugins/ajax-search-lite/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi John,

    The way it works is that the plugin checks through the sources in order to find an image.

    Right now it looks like that in your case it gets to the Alternative image source 4 – Page Screenshot which I usually do not recommend using. It’s an external service which wordpress uses and it often results in a black image instead of an actual image.

    A possible optimal configuration is:

    Primary image source  - Featured Image
    Alternative image source 1 - Post Content
    Alternative image source 2 - Post Excerpt
    Alternative image source 3 - Disabled
    Alternative image source 4 - Disabled

    In this case, if there is no feature image, and the plugin can’t find anything in the content or excerpt, then it leaves the image field empty.

    I’ve looked at the plugin in question, but it seems that it stores images differently. (in a custom field as array of image IDs)
    It is however still possible to make it work with a custom filter. I’ve put together a small snippet for you, which should solve the problem. Use this code in your functions.php file in your current theme directory:

    add_filter('asl_results', 'asl_get_ex_images', 1, 1);
    function asl_get_ex_images( $results ) {
      foreach ($results as $k => $r) {
        if ( isset($r->post_type) && $r->post_type == 'it_exchange_prod' ) {
          $x = get_post_meta($r->id, '_it-exchange-product-images', true);
          if ( is_array($x) && isset($x[0]) )
            $r->image = wp_get_attachment_url( $x[0] );
        }
      }
      return $results;
    }

    Also, make sure to change the image configuration to the one I mentioned above.

    I hope this helps.

    Thread Starter JohnAndDeanna

    (@johnanddeanna)

    Thanks.
    Will give it a go.
    I gave it a go and it is a GO! Thanks so much.
    Your help and time greatly appreciated.
    Regards,
    John

    Plugin Author wpdreams

    (@wpdreams)

    You are welcome John, I’m happy it works for you 🙂

    Feel free to rate the plugin if you like it, if you find other issues, let me know in another topic!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Lack of image presentation’ is closed to new replies.