Tagged: woocommerce
-
AuthorPosts
-
June 3, 2015 at 10:30 am #453664
Hi
I want to move, on single product pages, the product image from the sidebar (leaving categories tree in it) to the single product summary, just between description and metas…
But I don’t really understand where I have to modify the code. I’m fluent with “classical” wordpress templates, but it’s my first time with Woocommerce and it’s slightly difficult !!!
Sorry for my bad english :-p
With my best regards
Cédric (France)
June 4, 2015 at 4:17 am #454209Hi,
Can you post the link to one of your Products please?
Regards,
JosueJune 4, 2015 at 8:25 am #454282This reply has been marked as private.June 4, 2015 at 11:09 pm #454791Hi,
Try adding this at the very end of your theme / child theme functions.php file:
function add_custom_script(){ if(is_singular('product')){ ?> <script> (function($){ $(window).load(function() { $(".single-product-summary .summary").after($(".single-product-main-image .images").detach()); }); })(jQuery); </script> <?php } } add_action('wp_footer', 'add_custom_script');
Regards,
JosueJune 5, 2015 at 12:31 am #454834Mmmmmhhh… yes it works BUT it’s a javascript solution :-p
I want to find a pure PHP solution.
June 5, 2015 at 12:36 am #454838Is there any particular reason for that? if you’re concerned about SEO don’t be as the image is being moved between
div
elements (not headings or other key SEO elements).Regards,
JosueJune 5, 2015 at 3:22 pm #455123Yes
That’s why I wanted to move the image (alone, only resizable for responsive, not extendable larger than its original size) just between the short description and the reference’s block… But in the same div ;-)
June 7, 2015 at 7:55 am #455590Hi!
Add this in the functions.php file:
# # removes the default post image from shop overview pages and replaces it with this image # function avia_woocommerce_thumbnail_mod($asdf) { global $product, $avia_config; $rating = $product->get_rating_html(); //get rating $id = get_the_ID(); $size = 'shop_catalog'; echo "<div class='thumbnail_container'>"; echo avia_woocommerce_gallery_first_thumbnail( $id , $size); echo get_the_post_thumbnail( $id , $size ); if(!empty($rating)) echo "<span class='rating_container'>".$rating."</span>"; if($product->product_type == 'simple') echo "<span class='cart-loading'></span>"; echo "</div>"; } add_action( 'woocommerce_after_single_product_summary', 'avia_woocommerce_thumbnail_mod' ); remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); remove_action( 'woocommerce_before_shop_loop_item_title', 'avia_woocommerce_thumbnail', 20);
Cheers!
IsmaelJune 8, 2015 at 9:57 am #455849MMmmhhh ah yes it’s a good solution, I just want the original size image and not the thumbnail, but for this I think I’ll easily find the solution :-)
Thanks !!!
-
AuthorPosts
- The topic ‘[Woocommerce] How to move image product from sidebar to product summary ?’ is closed to new replies.