-
AuthorPosts
-
May 5, 2015 at 12:24 pm #439658
Ok – I´m using enfold and need to do some changes to the productpages. I made a screenshoot that shows visually how the pages are looking just now (to the right) – and how I wan´t them to be (the left side).
I want all the productpages to look the same – and the videos are uploaded on youtube.
I need to have the option to put som pictures for different colors (maybe below the video – or inside another tab) – and of course a way to choose color and unit before add to chart… But I think that possiblity already is in place.
So what I really want is for the Video to be bigger and to be places below the produktname – and the tabs with the disciptions to show beside the video – to the left. And on a smaller screen such as a mobile i will get like in this picture….
Is there some easy way to fix this?
May 6, 2015 at 11:57 am #440263Hey idespiran!
Thank you for using Enfold.
Do you want to replace the product image with a video? Are you going to do this for all products? It’s possible but you need to add a custom field. Edit the product then go to the Screen Options. Enable the custom field, add a new field called “product_video” then add the youtube url as value. If possible, use this kind of youtube url format: http://www.youtube.com/watch?v=G0k3kHtyoqc
Add this in the functions.php file:
add_filter('woocommerce_single_product_image_html','avia_woocommerce_post_thumbnail_description', 10, 2); function avia_woocommerce_post_thumbnail_description($img, $post_id) { global $post, $woocommerce, $product; $image_title = esc_attr(get_post_field('post_content', get_post_thumbnail_id())); $image_link = wp_get_attachment_url( get_post_thumbnail_id() ); $image = get_the_post_thumbnail( $post->ID, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ), array( 'title' => $image_title ) ); $attachment_count = count( $product->get_gallery_attachment_ids() ); if ( $attachment_count > 0 ) { $gallery = '[product-gallery]'; } else { $gallery = ''; } $video = get_post_meta( $post->ID, 'product_video', true ); $echo = do_shortcode("[av_video src='{$video}' format='16-9' width='16' height='9' custom_class='']"); if(has_post_thumbnail() && get_post_meta( $post->ID, 'product_video', true )) { return sprintf( $echo . '<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" rel="prettyPhoto' . $gallery . '">%s</a>', $image_link, $image_title, $image); } elseif(has_post_thumbnail() && empty($video)) { return sprintf( '<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" rel="prettyPhoto' . $gallery . '">%s</a>', $image_link, $image_title, $image); } else { return $img; } }
In order to make the video bigger, add this in the Quick CSS field:
.single-product-main-image { width: 50%; }
For further modifications, please contact codeable: http://kriesi.at/contact/customization
Cheers!
IsmaelAugust 5, 2021 at 10:47 am #1314596Hi Ismael,
Is this still valid for 2021 version of Enfolds 4.8.6
I have implemented the code in the Child theme functions.php file
Added custom field “product_video” to the product
Pasted in Youtube Watch url
Updated product
Enfold Child > Theme Options > Shop Options > Product Gallery = Default enfold product gallery (and not the WooCommerce 3.0 product Gallery)A quick multi-file test search of enfolds theme does not reveal the use of the function woocommerce_single_product_image_html
The Enfolds Gallery uses these two functions
avia_woocommerce_thumbnail OR avia_woocommerce_gallery_first_thumbnail
Hoping you can help update this code so that the filter works with Default enfold product gallery
I’d also like the Video as the fist item in the product gallery.
Yes I can achieve this using WooCommerce 3.0 product Gallery and a plugin – YITH WooCommerce Featured Audio and Video Content Premium
However, I would really like to work out a solution using “Default enfold product gallery”
Are their any specific hooks or filters to achieve this?
August 10, 2021 at 9:09 am #1316002Hi,
We did some changes in the product gallery in the later versions of the theme, so the modification above is no longer valid. The filter was also created before the release of the Woocommerce 3.0 gallery.
You might be able to accomplish the same thing by creating a copy of the woocommerce\templates\single-product\product-image.php template file in your child theme.
Best regards,
IsmaelAugust 31, 2021 at 6:12 pm #1319226I have added the product video extension https://woocommerce.com/products/product-video-for-woocommerce/?quid=93eb2a4be8e710d3cf1de9c4786b40fd to my staging site (noted privately), but it does not put the video in the standard featured image box, able to break out into a lightbox. Any idea why? How can I get videos into featured image area or gallery below it (or back and forth as needed)? Thanks…
September 2, 2021 at 8:09 am #1319444Hi,
Did you enable the Woocommerce 3.0 gallery from the Enfold > Shop Option panel? The plugin may not work with the theme’s default gallery. Please feel free to open a new thread if you need more help. We will close this one for now.
Best regards,
Ismael -
AuthorPosts
- The topic ‘Is there an easy way to change where video shows on productpage…’ is closed to new replies.