-
AuthorPosts
-
January 21, 2018 at 8:11 pm #900451
Hi Kriesi,
I know we have Hover image option on single product page that changes main image with first gallery image. But we have 500 products and we can’t do this manually. We need some code or css that can do this for products?
Please see website URL in private content area.
Thanks
AadilJanuary 24, 2018 at 4:19 am #901868Hey danielromanin,
Thank you for using Enfold.
Do you want to set the second option of the “Hover effect on Overview Pages” as default? You have to modify the config-woocommerce > admin-options.php file, look for this code around line 174:
$elements[] = array("slug" => "avia_product_hover", "name" => "Hover effect on <strong>Overview Pages</strong>", "desc" => "Do you want to display a hover effect on overview pages and replace the default thumbnail with the first image of the gallery?", "id" => "_product_hover", "type" => "select", "std" => "", "class" => "avia-style", "subtype" => array("Yes - show first gallery image on hover" => 'hover_active', "No hover effect" => ''));
.
Set the “std” parameter to “hover_active”.
"std" => "hover_active",
Best regards,
IsmaelJune 5, 2020 at 2:31 pm #1219826Hello!!
Can you bring me a piece of code to add via Child theme, please?
To avoid forget it when main theme will be update.Thanks in advance!
June 9, 2020 at 9:23 am #1220783Hi,
You can copy the whole avia_woocommerce_product_elements function in the child theme, rename the function and do your own modifications.
remove_filter( 'avf_builder_elements', 'avia_woocommerce_product_elements', 500, 1 ); add_filter( 'avf_builder_elements', 'avia_woocommerce_product_elements_mod', 500, 1 ); function avia_woocommerce_product_elements_mod( $elements ) { $posttype = avia_backend_get_post_type(); if( ! empty( $posttype ) && $posttype == 'product' ) { $elements[] = array("slug" => "avia_product_hover", "name" => "Hover effect on <strong>Overview Pages</strong>", "desc" => "Do you want to display a hover effect on overview pages and replace the default thumbnail with the first image of the gallery?", "id" => "_product_hover", "type" => "select", "std" => "", "class" => "avia-style", "subtype" => array("Yes - show first gallery image on hover" => 'hover_active', "No hover effect" => '')); $counter = 0; foreach( $elements as $element ) { if( $element['id'] == 'sidebar' ) { $elements[ $counter ]['required'] = ''; } else if( $element['id'] == 'layout' ) { $elements[ $counter ]['builder_active'] = true; // unset($elements[$counter]); } $counter++; } } return $elements; }
Best regards,
IsmaeleJune 9, 2020 at 10:27 am #1220812Hello Ismaele!
Well, works but,,, now appears two times….
Can you check it, pelase?
Thanks again!____
Ummm,,,
For future theme updates, you may want to consider adding this feature (activate on all new products), maybe in theme settings > Shop Options.June 11, 2020 at 1:26 pm #1221670Hi,
Try to wrap the remove_filter line inside an after_setup_theme hook.
add_action('after_setup_theme', function() { remove_filter( 'avf_builder_elements', 'avia_woocommerce_product_elements', 500, 1 ); }, 10);
And if you want to enable the option by default, look for this line:
"std" => "",
.. and replace it with:
"std" => "hover_active",
Best regards,
IsmaelJune 12, 2020 at 7:21 am #1221958Hi Ismael,
Now works fine!
You can close this issue.Thanks!!!
***
For future theme updates, you may want to consider adding this feature (activate on all new products), maybe in theme settings > Shop Options.June 12, 2020 at 12:35 pm #1222014 -
AuthorPosts
- The topic ‘Change single product image on hover with gallery first image’ is closed to new replies.