Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #7943

    How can I get the images that show on the main page and product pages

    Example: http://www.kriesi.at/themes/abundance/product-category/photography/

    to show up on the search results page?

    Example:

    http://www.kriesi.at/themes/abundance/?s=canon

    I checked the search loop, and it’s looking for a “preview” image, but I’m not sure what that is. I don’t really want to put the image in the product content, I just want it to show the feature image like it is used elsewhere.

    #59798

    Any feedback on this?

    #59799

    Hey,

    you can try to replace following code in loop-search.php:

    echo $image;

    with:

    echo $image;
    echo get_the_post_thumbnail( get_the_ID(), 'shop_catalog' );

    #59800

    Glad I found this topic. I wanted to do the exact same thing,

    (and also remove the date and time from the resulting posts,

    which I was able to accomplish, thanks to this post)

    Dude, I gave that code a shot but it did not work.

    Any other suggestions?

    Thanks in advance!

    #59801

    Dude,

    That solution didn’t work for me, but it pointed me in the right direction. What I found was that your code wasn’t working because the IF statement a few lines up, that assigns a value to $image, wasn’t being met. It seems it is basically checking for a slideshow? And if it doesn’t find one, then the $image is left blank, so your code is never output (as it only runs if $image has a value).

    So, what I’ve doing, going back to the original code, is to find:

    if( is_array($slides) && !empty( $slides[0] ) )

    {

    $image = avia_image_by_id($slides[0], 'widget', 'image');

    }

    and replace with

    if( get_the_post_thumbnail ( get_the_ID() ) )

    {

    $image = get_the_post_thumbnail( get_the_ID(), 'shop_catalog' );

    }

    The result is: http://ongward.com/?s=earring

    Which is better, except for a couple things. One, I’m not sure if this code is the correct way to do it? Let me know what you think. Secondly, the image size is too small. I would like it to appear larger, but haven’t figured that out yet. It may be that a CSS style is forcing it to that size? I thought doing something like get_the_post_thumbnail(get_the_ID(), ‘large’) would change the size, but it doesn’t. I’m also not sure what “shop_catalog” is being used for in the function call to get the thumbnail. It works just the same if I remove or replace it? Lastly, I don’t like how the description appears below the thumbnail, I want it to appear under the title text, to the right of the thumbnail. This should be some simple CSS modifications… I think. Hopefully I don’t have to arrange the order of the output in the loop_search file.

    #59802

    Quick update… I was able to adjust the size of the thumbnails by adding the following to the Quick CSS area in the Abundance Styling options, overriding the settings in the style.css file:

    .news-thumb{

    margin-right:9px;

    padding:3px;

    float:left;

    height:100px;

    width:100px;

    background: #f8f8f8;

    margin-top: 4px;

    }

    .tweet-thumb img, .news-thumb img{

    width:100px;

    height:100px;

    }

    This is the original, in the styles.css file, which I left alone.

    .news-thumb{

    margin-right:9px;

    padding:3px;

    float:left;

    height:36px;

    width:36px;

    background: #f8f8f8;

    margin-top: 4px;

    }

    .tweet-thumb img, .news-thumb img{

    width:36px;

    height:36px;

    }

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Adding featured image to search results’ is closed to new replies.