Viewing 6 replies - 1 through 6 (of 6 total)
  • replace all code from marketpress-product-gallery/includes/gallery.php with this one:

    $html = '';
    	if( has_post_thumbnail( $post->ID )  ){
    	$html .= '<div class="mp_gallery_wrap">';
    		$html .= '<div class="mp_gallery_viewport">';
    			$html .= '<div class="mp_gallery_image">';
    				$large = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
    				$html .= '<img class="mp_zoom" src="'. $large[0] .'">';
    			$html .= '</div>';
    			$html .= '<div class="mp_gallery_title"><span>';
    				$html .= $mp_prod_image_title[0];
    			$html .= '</span></div>';
    		$html .= '</div>';
    
    		if( $mp_prod_img_id[0] != '' ){
    		$html .= '<div class="mp_image_collection">';
    			$html .= '<div class="mp_control_left"><img class="mp-icon" src="'. plugins_url() .'/marketpress-product-gallery/img/left.png"></div>';
    			$html .= '<div class="mp_control_right"><img class="mp-icon" src="'. plugins_url() .'/marketpress-product-gallery/img/right.png"></div>';
    			$html .= '<div class="mp_image_list"><ul>';
    				$img_smale = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'small' );
    				$html .= '<li>';
    				$html .= '<img src="'. $img_smale[0] .'">';
    				$html .= '<input type="hidden" value="'.$large[0].'">';
    				$html .= '<div class="mp_hide"></div>';
    				$html .= '</li>';
    				$i = 0;
    				foreach( $mp_prod_image_paths as $mp_prod_image_path ) {
    				$html .= '<li>';
    				$thumb = wp_get_attachment_image_src($mp_prod_img_id[$i], 'mp-thumb');
    				$large = wp_get_attachment_image_src($mp_prod_img_id[$i], 'mp-large-view');
    				$html .= '<img src="'. $thumb[0] .'">';
    				$html .= '<input type="hidden" value="'.$large[0].'">';
    				$html .= '<div class="mp_hide">' . $mp_prod_image_title[$i++] . '</div>';
    				$html .= '</li>';
    				}
    			$html .= '</ul></div>';
    		$html .= '</div>';
    		}
    	$html .= '</div>';
    	}

    Hi @creative Themes,

    I hope you are well today and thanks for sharing the solution here.

    Your help here is really appreciated.

    Thanks,
    Vinod Dalvi

    Hi @msprince,

    Thank you for your question.

    Could you please try using the solution posted by @creative Themes in his previous reply and let us know how it works for you?

    Kind Regards,
    Vinod Dalvi

    Thread Starter MsPrince

    (@msprince)

    Hi, Unfortunately this code doesn’t seem to work for my site, the featured image remains blank and the mp gallery box disappears from the product page as well, perhaps something else would do? I am using the template function so I wonder does that have an effect.

    Hey MsPrince,

    Sorry for the huge delay.

    Tested the above code and unfortunately it didn’t work for me either.

    I wasn’t able to pull this alone,so I had to ask my buddy Jose (who is amazing, but don’t have account here). And he was able to code a solution to make the first gallery image featured one.

    Important: this code will override the featured image when you save the post (if there are gallery images, of course). So, it requires to re-save already created products

    Also you will need to use it in the end of functions.php file in your active theme, or as a mu-plugin.
    If you need more information about mu-plugins you can check this link.

    At last you can find the actual code here.

    Let me know if I can help you with something else.

    Thanks,
    Ivan

    Just turn off Show Product Images in settings for MarketPress Lite eCommerce plugin.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Have first image of marketpress gallery replace featured image’ is closed to new replies.