Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1006785

    Post #805258 shows the code (below), to add to the loop-search.php file, which adds an image to the product search results page. Although it works perfect, you only get a text link to the product.

    How can you add the same link to image as well?

    Thanks.

    REPLACE:
    echo “<span class=’search-result-counter {$counterclass}’>{$post_loop_count}</span>”;

    WITH:
    $searchimage = get_the_post_thumbnail( $the_id, ‘large’ );
    echo “<span class=’search-result-image’>{$searchimage}</span>”;
    echo “<span class=’search-result-counter {$counterclass}’>{$post_loop_count}</span>”;

    QUICK CSS:
    .search-result-image img {
    width: 300px;
    }

    #1007401

    Hey dwags52,
    Please try editing the loop-search.php file, and replacing line 31:

    echo "<span class='search-result-counter {$counterclass}'>{$post_loop_count}</span>";

    with:

                    $searchimage = get_the_post_thumbnail( $the_id, 'large' );
                    echo "<span class='search-result-image'><a title='".the_title_attribute('echo=0')."' href='".get_permalink()."' $markup>{$searchimage}</a></span>";
                    echo "<span class='search-result-counter {$counterclass}'>{$post_loop_count}</span>";

    and use the same Quick CSS:

    .search-result-image img {
    width: 300px;
    }

    Best regards,
    Mike

    #1008461

    Hi Mike.
    Thanks so much for the help.

    Worked perfect!

    Dwight

    #1008515

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Adding link to search result image’ is closed to new replies.