• Resolved aarondub84

    (@aarondub84)


    I have the ajax search results enabled. I turned on the option to show the image within the results. I am resizing the image with css and since it is pulling the thumbnail (I assume) it is very pixelated. Is there a way to pull the medium or large image?

    • This topic was modified 4 years, 3 months ago by Jan Dembowski.

    The page I need help with: [log in to see the link]

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

    (@vinod-dalvi)

    I hope you are well today and thank you for your question.

    Could you please share the page URL from your site where it is displaying so that I can help you?

    Best regards,

    Thread Starter aarondub84

    (@aarondub84)

    For some reason this was marked as resolved, but I would still like to know if there’s a way to use a higher res image in the search results.

    Plugin Author Vinod Dalvi

    (@vinod-dalvi)

    You didn’t answer my previous question but now I saw that you have added the URL in your initial reply.

    I can see you are using the AJAX search results and you can change the image size in the search results by using the plugin is_ajax_image_size filter hook which is added in the below plugin function.

    	function image_markup( $field, $post ) {
    		$image = '';
            $image_size = apply_filters( 'is_ajax_image_size', 'thumbnail' );
    		$temp_id = 0;
    		if ( 'product' === $post->post_type ) {
    			$_product = wc_get_product( $post );
    			$temp_id = $_product->get_id();	
    		} else {
    			$temp_id = $post->ID;	
    		} 
    		if( 'attachment' === $post->post_type ) {
    			$image = wp_get_attachment_image( $temp_id, $image_size );
    		} else if( has_post_thumbnail( $temp_id) ) {
    			$image = get_the_post_thumbnail( $temp_id, $image_size );
    		}
    		$is_markup = apply_filters( 'is_customize_image_markup', false );
    		if ( $is_markup ) {
    			do_action( 'is_image_markup', $image, $field );
    		} else if ( isset( $field['show_image'] ) && $field['show_image'] ) { ?>
                        <div class="left-section">
                            <div class="thumbnail">
                                <a href="<?php echo get_the_permalink( $temp_id ); ?>"><?php echo $image; ?></a>
                            </div>
                        </div>
    		<?php }
    	}
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Use higher res image in search result’ is closed to new replies.