PluginProbe ʕ •ᴥ•ʔ
Slider Ultimate / 2.0.8
Slider Ultimate v2.0.8
trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9
ultimate-slider / includes / WooCommerceIntegration.class.php
ultimate-slider / includes Last commit date
BackwardsCompatibility.class.php 4 years ago Blocks.class.php 4 years ago CustomPostTypes.class.php 4 years ago Dashboard.class.php 4 years ago DeactivationSurvey.class.php 4 years ago InstallationWalkthrough.class.php 4 years ago Permissions.class.php 4 years ago ReviewAsk.class.php 4 years ago Settings.class.php 4 years ago Widgets.class.php 4 years ago WooCommerceIntegration.class.php 4 years ago template-functions.php 4 years ago
WooCommerceIntegration.class.php
51 lines
1 <?php
2
3 /**
4 * Class to replace the main WooCommerce product image with a slider
5 * that contains all of the product images
6 */
7
8 if ( !defined( 'ABSPATH' ) )
9 exit;
10
11 class ewdusWooCommerceIntegration {
12
13
14 public function __construct() {
15
16 add_filter( 'woocommerce_single_product_image_thumbnail_html', array( $this, 'remove_wc_thumbnails' ) );
17 add_filter( 'woocommerce_single_product_image_html', array( $this, 'replace_woocommerce_image' ), 10, 2 );
18 }
19
20 /**
21 * Replace main WooCommerce image with a slider containing all product images
22 * @since 2.0.0
23 */
24 public function replace_woocommerce_image( $html, $product_id ) {
25
26 $product = wc_get_product( $product_id );
27
28 $post_ids = get_post_thumbnail_id( $product_id );
29 $attachment_ids = $product->get_gallery_attachment_ids();
30
31 if ( $attachment_ids ) {
32
33 foreach ( $attachment_ids as $attachment_id ) {
34 $post_ids .= "," . $attachment_id;
35 }
36
37 return do_shortcode( '[ultimate-slider post__in_string="' . $post_ids . '"]' );
38 }
39
40 return $html;
41 }
42
43 /**
44 * Remove the product image thumbnails if displaying the slider
45 * @since 2.0.0
46 */
47 public function remove_wc_thumbnails() {
48
49 return null;
50 }
51 }