Changeset 3333374
- Timestamp:
- 07/24/2025 08:40:07 AM (8 months ago)
- Location:
- product-gallery-swiper-for-woocommerce
- Files:
-
- 39 added
- 6 edited
-
tags/1.5.8 (added)
-
tags/1.5.8/LICENSE.txt (added)
-
tags/1.5.8/README.txt (added)
-
tags/1.5.8/admin (added)
-
tags/1.5.8/admin/class-wdevs-gallery-swiper-admin.php (added)
-
tags/1.5.8/admin/index.php (added)
-
tags/1.5.8/admin/js (added)
-
tags/1.5.8/admin/js/wdevs-gallery-swiper-admin.js (added)
-
tags/1.5.8/includes (added)
-
tags/1.5.8/includes/class-wdevs-gallery-swiper-activator.php (added)
-
tags/1.5.8/includes/class-wdevs-gallery-swiper-deactivator.php (added)
-
tags/1.5.8/includes/class-wdevs-gallery-swiper-loader.php (added)
-
tags/1.5.8/includes/class-wdevs-gallery-swiper-woocommerce.php (added)
-
tags/1.5.8/includes/class-wdevs-gallery-swiper.php (added)
-
tags/1.5.8/includes/index.php (added)
-
tags/1.5.8/languages (added)
-
tags/1.5.8/languages/product-gallery-swiper-for-woocommerce-en_US.l10n.php (added)
-
tags/1.5.8/languages/product-gallery-swiper-for-woocommerce-en_US.mo (added)
-
tags/1.5.8/languages/product-gallery-swiper-for-woocommerce-en_US.po (added)
-
tags/1.5.8/languages/product-gallery-swiper-for-woocommerce-nl_NL.l10n.php (added)
-
tags/1.5.8/languages/product-gallery-swiper-for-woocommerce-nl_NL.mo (added)
-
tags/1.5.8/languages/product-gallery-swiper-for-woocommerce-nl_NL.po (added)
-
tags/1.5.8/languages/product-gallery-swiper-for-woocommerce.pot (added)
-
tags/1.5.8/public (added)
-
tags/1.5.8/public/class-wdevs-gallery-swiper-public.php (added)
-
tags/1.5.8/public/css (added)
-
tags/1.5.8/public/css/wdevs-gallery-swiper-public.css (added)
-
tags/1.5.8/public/index.php (added)
-
tags/1.5.8/public/js (added)
-
tags/1.5.8/public/js/wdevs-gallery-swiper-public.js (added)
-
tags/1.5.8/public/js/woo-product-filter-by-wbw.js (added)
-
tags/1.5.8/public/js/xstore-theme.js (added)
-
tags/1.5.8/public/js/yith-infinite-scrolling.js (added)
-
tags/1.5.8/public/vendor (added)
-
tags/1.5.8/public/vendor/swiper (added)
-
tags/1.5.8/public/vendor/swiper/swiper-bundle.min.css (added)
-
tags/1.5.8/public/vendor/swiper/swiper-bundle.min.js (added)
-
tags/1.5.8/uninstall.php (added)
-
tags/1.5.8/wdevs-gallery-swiper.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/languages/product-gallery-swiper-for-woocommerce-nl_NL.l10n.php (modified) (1 diff)
-
trunk/languages/product-gallery-swiper-for-woocommerce-nl_NL.mo (modified) (previous)
-
trunk/languages/product-gallery-swiper-for-woocommerce-nl_NL.po (modified) (4 diffs)
-
trunk/public/class-wdevs-gallery-swiper-public.php (modified) (11 diffs)
-
trunk/wdevs-gallery-swiper.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
product-gallery-swiper-for-woocommerce/trunk/README.txt
r3333160 r3333374 4 4 Requires at least: 6.0 5 5 Tested up to: 6.8 6 Stable tag: 1.5. 76 Stable tag: 1.5.8 7 7 Requires PHP: 7.2 8 8 License: GPL-2.0+ … … 65 65 66 66 == Changelog == 67 = 1.5.8 = 68 * Added new rendering filters/actions for third party compatibility adjustments 69 * Added helper functions for cleaner code organization and better maintainability 70 * Updated code structure with better method organization and documentation 71 * Updated theme compatibility handling with more modular approach 72 67 73 = 1.5.7 = 68 74 * Added option to enable/disable hover functionality when slider is disabled above breakpoint -
product-gallery-swiper-for-woocommerce/trunk/languages/product-gallery-swiper-for-woocommerce-nl_NL.l10n.php
r3313906 r3333374 1 1 <?php 2 2 // generated by Poedit from product-gallery-swiper-for-woocommerce-nl_NL.po, do not edit directly 3 return ['domain'=>NULL,'plural-forms'=>'nplurals=2; plural=(n != 1);','language'=>'nl_NL','pot-creation-date'=>'2025-0 6-18 15:48+0200','po-revision-date'=>'2025-06-18 15:51+0200','translation-revision-date'=>'2025-06-18 15:51+0200','project-id-version'=>'Product Gallery Slider for WooCommerce','x-generator'=>'Poedit 3.6','messages'=>['Settings'=>'Instellingen','This plugin requires WooCommerce. Please install and activate WooCommerce before activating this plugin.'=>'Deze plugin vereist WooCommerce. Installeer en activeer WooCommerce voordat u deze plugin activeert.','Gallery Swiper'=>'Galerij Swiper','Gallery Swiper settings'=>'Galerij Swiper instellingen','Customize the Gallery slider settings.'=>'Pas de instellingen van de Gallery Slider aan.','Enable scrollbar'=>'Schakel scrollbalk in','Enable scrollbar for the slider'=>'Schakel scrollbalk in voor de slider','Enable pagination'=>'Schakel paginering in','Enable pagination for the slider'=>'Schakel paginering in voor de slider','Enable navigation'=>'Schakel navigatie in','Enable navigation for the slider'=>'Schakel navigatie in voor de slider','Enable variation images'=>'Schakel variatie-afbeeldingen in','Display variation images in the slider'=>'Variatie-afbeeldingen weergeven in de slider','Disable slider from'=>'Schakel slider uit vanaf','When set, the slider will be disabled from the specified breakpoint upwards, and the second product image will be displayed on mouse hover.'=>'Indien ingesteld, wordt de slider uitgeschakeld vanaf het gespecificeerde breekpunt en hoger, en wordt de tweede productafbeelding weergegeven bij het hoveren met de muis.','Always enabled'=>'Altijd ingeschakeld','Disabled from 480px and up'=>'Uitgeschakeld vanaf 480px en hoger','Disabled from 768px and up'=>'Uitgeschakeld vanaf 768px en hoger','Disabled from 992px and up'=>'Uitgeschakeld vanaf 992px en hoger','Disabled from 1200px and up'=>'Uitgeschakeld vanaf 1200px en hoger','Theme color'=>'Themakleur','Choose the Swiper theme color'=>'Kies de Swiper themakleur','Product Gallery Swiper for WooCommerce is developed by %s. Your trusted WordPress & WooCommerce plugin partner from the Netherlands.'=>'Product Gallery Swiper for WooCommerce is ontwikkeld door %s. Uw betrouwbare WordPress & WooCommerce pluginpartner uit Nederland.','Documentation'=>'Documentatie','Product Gallery Swiper for WooCommerce'=>'Productgalerij Swiper voor WooCommerce','https://products.wijnberg.dev'=>'https://products.wijnberg.dev','Enhances WooCommerce product images display on product listing sections, providing a responsive and touch-friendly swiper.'=>'Verbetert de weergave van WooCommerce productafbeeldingen in productoverzichten, met een responsieve en gebruiksvriendelijke slider.','Wijnberg Developments'=>'Wijnberg Developments']];3 return ['domain'=>NULL,'plural-forms'=>'nplurals=2; plural=(n != 1);','language'=>'nl_NL','pot-creation-date'=>'2025-07-23 22:38+0200','po-revision-date'=>'2025-07-23 22:40+0200','translation-revision-date'=>'2025-07-23 22:40+0200','project-id-version'=>'Product Gallery Slider for WooCommerce','x-generator'=>'Poedit 3.6','messages'=>['Settings'=>'Instellingen','This plugin requires WooCommerce. Please install and activate WooCommerce before activating this plugin.'=>'Deze plugin vereist WooCommerce. Installeer en activeer WooCommerce voordat u deze plugin activeert.','Gallery Swiper'=>'Galerij Swiper','Gallery Swiper settings'=>'Galerij Swiper instellingen','Customize the Gallery slider settings.'=>'Pas de instellingen van de Gallery Slider aan.','Enable scrollbar'=>'Schakel scrollbalk in','Enable scrollbar for the slider'=>'Schakel scrollbalk in voor de slider','Enable pagination'=>'Schakel paginering in','Enable pagination for the slider'=>'Schakel paginering in voor de slider','Enable navigation'=>'Schakel navigatie in','Enable navigation for the slider'=>'Schakel navigatie in voor de slider','Enable variation images'=>'Schakel variatie-afbeeldingen in','Display variation images in the slider'=>'Variatie-afbeeldingen weergeven in de slider','Disable slider from'=>'Schakel slider uit vanaf','When set, the slider will be disabled from the specified breakpoint upwards.'=>'Indien ingesteld, wordt de slider uitgeschakeld vanaf het gespecificeerde breekpunt en hoger.','Always enabled'=>'Altijd ingeschakeld','Disabled from 480px and up'=>'Uitgeschakeld vanaf 480px en hoger','Disabled from 768px and up'=>'Uitgeschakeld vanaf 768px en hoger','Disabled from 992px and up'=>'Uitgeschakeld vanaf 992px en hoger','Disabled from 1200px and up'=>'Uitgeschakeld vanaf 1200px en hoger','Enable hover on disabled slider'=>'Schakel muisbeweging in bij uitgeschakelde slider','When the slider is disabled (above breakpoint), show the second image on mouse hover.'=>'Wanneer de slider is uitgeschakeld (boven breekpunt), de tweede productafbeelding weergegeven bij het hoveren met de muis.','Theme color'=>'Themakleur','Choose the Swiper theme color'=>'Kies de Swiper themakleur','Product Gallery Swiper for WooCommerce is developed by %s. Your trusted WordPress & WooCommerce plugin partner from the Netherlands.'=>'Product Gallery Swiper for WooCommerce is ontwikkeld door %s. Uw betrouwbare WordPress & WooCommerce pluginpartner uit Nederland.','Documentation'=>'Documentatie','Product Gallery Swiper for WooCommerce'=>'Productgalerij Swiper voor WooCommerce','https://products.wijnberg.dev'=>'https://products.wijnberg.dev','Enhances WooCommerce product images display on product listing sections, providing a responsive and touch-friendly swiper.'=>'Verbetert de weergave van WooCommerce productafbeeldingen in productoverzichten, met een responsieve en gebruiksvriendelijke slider.','Wijnberg Developments'=>'Wijnberg Developments']]; -
product-gallery-swiper-for-woocommerce/trunk/languages/product-gallery-swiper-for-woocommerce-nl_NL.po
r3313906 r3333374 3 3 msgstr "" 4 4 "Project-Id-Version: Product Gallery Slider for WooCommerce\n" 5 "POT-Creation-Date: 2025-0 6-18 15:48+0200\n"6 "PO-Revision-Date: 2025-0 6-18 15:51+0200\n"5 "POT-Creation-Date: 2025-07-23 22:38+0200\n" 6 "PO-Revision-Date: 2025-07-23 22:40+0200\n" 7 7 "Last-Translator: \n" 8 8 "Language-Team: \n" … … 23 23 "X-Poedit-SearchPathExcluded-2: public/vendor\n" 24 24 25 #: admin/class-wdevs-gallery-swiper-admin.php: 6226 #: includes/class-wdevs-gallery-swiper-woocommerce.php:2 7125 #: admin/class-wdevs-gallery-swiper-admin.php:83 26 #: includes/class-wdevs-gallery-swiper-woocommerce.php:282 27 27 msgid "Settings" 28 28 msgstr "Instellingen" … … 36 36 "u deze plugin activeert." 37 37 38 #: includes/class-wdevs-gallery-swiper-woocommerce.php:9 338 #: includes/class-wdevs-gallery-swiper-woocommerce.php:96 39 39 msgid "Gallery Swiper" 40 40 msgstr "Galerij Swiper" 41 41 42 #: includes/class-wdevs-gallery-swiper-woocommerce.php:1 0742 #: includes/class-wdevs-gallery-swiper-woocommerce.php:110 43 43 msgid "Gallery Swiper settings" 44 44 msgstr "Galerij Swiper instellingen" 45 45 46 #: includes/class-wdevs-gallery-swiper-woocommerce.php:1 0946 #: includes/class-wdevs-gallery-swiper-woocommerce.php:112 47 47 msgid "Customize the Gallery slider settings." 48 48 msgstr "Pas de instellingen van de Gallery Slider aan." 49 49 50 #: includes/class-wdevs-gallery-swiper-woocommerce.php:11 350 #: includes/class-wdevs-gallery-swiper-woocommerce.php:116 51 51 msgid "Enable scrollbar" 52 52 msgstr "Schakel scrollbalk in" 53 53 54 #: includes/class-wdevs-gallery-swiper-woocommerce.php:11 554 #: includes/class-wdevs-gallery-swiper-woocommerce.php:118 55 55 msgid "Enable scrollbar for the slider" 56 56 msgstr "Schakel scrollbalk in voor de slider" 57 57 58 #: includes/class-wdevs-gallery-swiper-woocommerce.php:12 058 #: includes/class-wdevs-gallery-swiper-woocommerce.php:123 59 59 msgid "Enable pagination" 60 60 msgstr "Schakel paginering in" 61 61 62 #: includes/class-wdevs-gallery-swiper-woocommerce.php:12 262 #: includes/class-wdevs-gallery-swiper-woocommerce.php:125 63 63 msgid "Enable pagination for the slider" 64 64 msgstr "Schakel paginering in voor de slider" 65 65 66 #: includes/class-wdevs-gallery-swiper-woocommerce.php:1 2766 #: includes/class-wdevs-gallery-swiper-woocommerce.php:130 67 67 msgid "Enable navigation" 68 68 msgstr "Schakel navigatie in" 69 69 70 #: includes/class-wdevs-gallery-swiper-woocommerce.php:1 2970 #: includes/class-wdevs-gallery-swiper-woocommerce.php:132 71 71 msgid "Enable navigation for the slider" 72 72 msgstr "Schakel navigatie in voor de slider" 73 73 74 #: includes/class-wdevs-gallery-swiper-woocommerce.php:13 474 #: includes/class-wdevs-gallery-swiper-woocommerce.php:137 75 75 msgid "Enable variation images" 76 76 msgstr "Schakel variatie-afbeeldingen in" 77 77 78 #: includes/class-wdevs-gallery-swiper-woocommerce.php:13 678 #: includes/class-wdevs-gallery-swiper-woocommerce.php:139 79 79 msgid "Display variation images in the slider" 80 80 msgstr "Variatie-afbeeldingen weergeven in de slider" 81 81 82 #: includes/class-wdevs-gallery-swiper-woocommerce.php:14 182 #: includes/class-wdevs-gallery-swiper-woocommerce.php:144 83 83 msgid "Disable slider from" 84 84 msgstr "Schakel slider uit vanaf" 85 85 86 #: includes/class-wdevs-gallery-swiper-woocommerce.php:14 386 #: includes/class-wdevs-gallery-swiper-woocommerce.php:146 87 87 msgid "" 88 "When set, the slider will be disabled from the specified breakpoint upwards, " 89 "and the second product image will be displayed on mouse hover." 88 "When set, the slider will be disabled from the specified breakpoint upwards." 90 89 msgstr "" 91 90 "Indien ingesteld, wordt de slider uitgeschakeld vanaf het gespecificeerde " 92 "breekpunt en hoger, en wordt de tweede productafbeelding weergegeven bij het " 93 "hoveren met de muis." 91 "breekpunt en hoger." 94 92 95 #: includes/class-wdevs-gallery-swiper-woocommerce.php:14 693 #: includes/class-wdevs-gallery-swiper-woocommerce.php:149 96 94 msgid "Always enabled" 97 95 msgstr "Altijd ingeschakeld" 98 96 99 #: includes/class-wdevs-gallery-swiper-woocommerce.php:1 4797 #: includes/class-wdevs-gallery-swiper-woocommerce.php:150 100 98 msgid "Disabled from 480px and up" 101 99 msgstr "Uitgeschakeld vanaf 480px en hoger" 102 100 103 #: includes/class-wdevs-gallery-swiper-woocommerce.php:1 48101 #: includes/class-wdevs-gallery-swiper-woocommerce.php:151 104 102 msgid "Disabled from 768px and up" 105 103 msgstr "Uitgeschakeld vanaf 768px en hoger" 106 104 107 #: includes/class-wdevs-gallery-swiper-woocommerce.php:1 49105 #: includes/class-wdevs-gallery-swiper-woocommerce.php:152 108 106 msgid "Disabled from 992px and up" 109 107 msgstr "Uitgeschakeld vanaf 992px en hoger" 110 108 111 #: includes/class-wdevs-gallery-swiper-woocommerce.php:15 0109 #: includes/class-wdevs-gallery-swiper-woocommerce.php:153 112 110 msgid "Disabled from 1200px and up" 113 111 msgstr "Uitgeschakeld vanaf 1200px en hoger" 114 112 115 #: includes/class-wdevs-gallery-swiper-woocommerce.php:155 113 #: includes/class-wdevs-gallery-swiper-woocommerce.php:158 114 msgid "Enable hover on disabled slider" 115 msgstr "Schakel muisbeweging in bij uitgeschakelde slider" 116 117 #: includes/class-wdevs-gallery-swiper-woocommerce.php:160 118 msgid "" 119 "When the slider is disabled (above breakpoint), show the second image on " 120 "mouse hover." 121 msgstr "" 122 "Wanneer de slider is uitgeschakeld (boven breekpunt), de tweede " 123 "productafbeelding weergegeven bij het hoveren met de muis." 124 125 #: includes/class-wdevs-gallery-swiper-woocommerce.php:166 116 126 msgid "Theme color" 117 127 msgstr "Themakleur" 118 128 119 #: includes/class-wdevs-gallery-swiper-woocommerce.php:1 57129 #: includes/class-wdevs-gallery-swiper-woocommerce.php:168 120 130 msgid "Choose the Swiper theme color" 121 131 msgstr "Kies de Swiper themakleur" 122 132 123 133 #. translators: %s: Link to author site. 124 #: includes/class-wdevs-gallery-swiper-woocommerce.php: 196134 #: includes/class-wdevs-gallery-swiper-woocommerce.php:207 125 135 #, php-format 126 136 msgid "" … … 131 141 "WordPress & WooCommerce pluginpartner uit Nederland." 132 142 133 #: includes/class-wdevs-gallery-swiper-woocommerce.php:2 45143 #: includes/class-wdevs-gallery-swiper-woocommerce.php:256 134 144 msgid "Documentation" 135 145 msgstr "Documentatie" -
product-gallery-swiper-for-woocommerce/trunk/public/class-wdevs-gallery-swiper-public.php
r3333160 r3333374 119 119 120 120 /** 121 * Initialize the plugin's public-facing functionality. 122 * 123 * This function is called when WooCommerce is initialized. It sets up all necessary 124 * actions and filters for the plugin to function properly. 125 * 126 * @since 1.0.0 127 */ 128 public function on_woocommerce_init() { 129 $this->setup_default_woocommerce_integration(); 130 131 // Hooks for external developers to call our methods 132 add_action( 'wdevs_gallery_swiper_start_gallery_rendering', [ $this, 'start_gallery_rendering' ] ); 133 add_action( 'wdevs_gallery_swiper_finish_gallery_rendering', [ $this, 'finish_gallery_rendering' ] ); 134 add_action( 'wdevs_gallery_swiper_render_gallery', [ $this, 'render_full_gallery' ], 10, 1 ); 135 136 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_styles' ] ); 137 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); 138 139 $this->add_themes_compatibility(); 140 $this->add_plugins_compatibility(); 141 } 142 143 /** 144 * Setup default WooCommerce integration. 145 * 146 * This method sets up the default gallery rendering hooks for WooCommerce product loops. 147 * External developers can disable this via the 'wdevs_gallery_swiper_enable_default_integration' filter. 148 * 149 * @since 1.5.8 150 */ 151 public function setup_default_woocommerce_integration() { 152 if ( apply_filters( 'wdevs_gallery_swiper_enable_default_integration', true ) ) { 153 add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'start_gallery_rendering' ], PHP_INT_MIN ); 154 add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'finish_gallery_rendering' ], PHP_INT_MAX ); 155 } 156 } 157 158 /** 121 159 * Add compatibility fixes for various themes. 122 160 * 123 * Currently, this function removes the secondary product image functionality124 * from the GeneratePress theme to avoid conflicts.161 * Handles compatibility with various themes including GeneratePress, Blocksy, and XStore. 162 * Removes conflicting elements and adjusts rendering behavior as needed. 125 163 * 126 164 * @since 1.0.0 … … 201 239 } ); 202 240 203 // GeneratePress Premium compatibility. Adjust gallery rendering timing for image wrapper conflict 204 if ( function_exists( 'generatepress_wc_image_wrapper_close' ) ) { 205 remove_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'start_gallery_rendering' ], PHP_INT_MIN ); 206 add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'start_gallery_rendering' ], 9 ); 207 remove_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'finish_gallery_rendering' ], PHP_INT_MAX ); 208 add_action( 'woocommerce_shop_loop_item_title', [ $this, 'finish_gallery_rendering' ], 7 ); 209 } 210 } 211 212 /** 213 * Initialize the plugin's public-facing functionality. 214 * 215 * This function is called when WooCommerce is initialized. It sets up all necessary 216 * actions and filters for the plugin to function properly. 217 * 218 * @since 1.0.0 219 */ 220 public function on_woocommerce_init() { 221 222 add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'start_gallery_rendering' ], PHP_INT_MIN ); 223 add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'finish_gallery_rendering' ], PHP_INT_MAX ); 224 225 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_styles' ] ); 226 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); 227 228 $this->add_themes_compatibility(); 229 $this->add_plugins_compatibility(); 230 231 } 232 233 /** 234 * Parse the breakpoint value from the settings. 235 * 236 * This function converts the breakpoint setting to an integer and validates it. 237 * 238 * @param string $breakpoint The breakpoint value from the settings. 239 * 240 * @return int|null The parsed breakpoint value or null if invalid. 241 * @since 1.1.0 242 */ 243 private function parse_breakpoint( $breakpoint ) { 244 $value = intval( $breakpoint ); 245 246 return $value > 0 ? $value : null; 247 } 241 // GeneratePress Premium WooCommerce compatibility. Adjust gallery rendering timing for image wrapper conflict 242 if ( function_exists( 'generatepress_is_module_active' ) ) { 243 if ( generatepress_is_module_active( 'generate_package_woocommerce', 'GENERATE_WOOCOMMERCE' ) ) { 244 $this->disable_default_thumbnail(); 245 246 // Use filter to disable default integration instead of remove_action 247 add_filter( 'wdevs_gallery_swiper_enable_default_integration', '__return_false' ); 248 add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'render_gallery_with_default_thumbnail' ], 10 ); 249 } 250 } 251 } 252 248 253 249 254 /** … … 259 264 public function start_gallery_rendering() { 260 265 if ( $this->should_display_gallery() ) { 261 echo '<div class="swiper">'; 266 $extra_classes = apply_filters( 'wdevs_gallery_swiper_container_extra_classes', '' ); 267 $container_classes = trim( 'swiper ' . $extra_classes ); 268 echo '<div class="' . esc_attr( $container_classes ) . '">'; 262 269 echo '<div class="swiper-wrapper">'; 263 270 echo '<div class="swiper-slide">'; … … 281 288 $product = wc_get_product(); 282 289 foreach ( $product->get_gallery_image_ids() as $attachment_id ) { 283 echo '<div class="swiper-slide">' . $this->get_product_image( $product, $attachment_id ) . '</div>';290 echo $this->wrap_in_slide( $this->get_product_image( $product, $attachment_id ) ); 284 291 } 285 292 … … 292 299 foreach ( $variations as $variation ) { 293 300 if ( ! empty( $variation['image_id'] ) && ! in_array( $variation['image_id'], $variation_images, true ) ) { 294 echo '<div class="swiper-slide">' . $this->get_product_image( $product, $variation['image_id'] ) . '</div>';301 echo $this->wrap_in_slide( $this->get_product_image( $product, $variation['image_id'] ) ); 295 302 $variation_images[] = $variation['image_id']; 296 303 } … … 309 316 310 317 /** 318 * Render the complete gallery with optional default thumbnail inclusion. 319 * 320 * Renders the full Swiper gallery structure, optionally including the default 321 * product thumbnail as the first slide. Used for theme compatibility adjustments. 322 * 323 * @param bool $include_default Whether to include the default thumbnail as first slide. 324 * 325 * @since 1.5.8 326 */ 327 public function render_full_gallery( $include_default = false ) { 328 $this->start_gallery_rendering(); 329 if ( $include_default ) { 330 $this->render_default_thumbnail_slide(); 331 } 332 $this->finish_gallery_rendering(); 333 } 334 335 /** 336 * Render the default product thumbnail as a Swiper slide. 337 * 338 * Creates a Swiper slide containing the default WooCommerce product thumbnail. 339 * Only renders if the gallery should be displayed for the current product. 340 * 341 * @since 1.5.8 342 */ 343 public function render_default_thumbnail_slide() { 344 if ( $this->should_display_gallery() ) { 345 echo $this->wrap_in_slide( woocommerce_get_product_thumbnail() ); 346 } 347 } 348 349 /** 311 350 * Determines if the gallery should be displayed. 312 351 * … … 317 356 * @since 1.4.0 318 357 */ 319 p rivatefunction should_display_gallery(): bool {358 public function should_display_gallery(): bool { 320 359 if ('product' !== get_post_type()) { 321 360 return false; … … 340 379 $consider_variation_images = (get_option('wdevs_gallery_swiper_variation_images', 'no') === 'yes'); 341 380 if($consider_variation_images){ 342 return $this->product_has_variation_images($product);343 } 344 345 return false;381 return apply_filters( 'wdevs_gallery_swiper_should_display_gallery', $this->product_has_variation_images($product) ); 382 } 383 384 return apply_filters( 'wdevs_gallery_swiper_should_display_gallery', false ); 346 385 } 347 386 … … 357 396 * @since 1.4.0 358 397 */ 359 p rivatefunction get_product_image( $product, $attachment_id ) {398 public function get_product_image( $product, $attachment_id ) { 360 399 if ( ! isset( $product ) ) { 361 400 return ''; … … 426 465 427 466 /** 428 * Checks if the product has a variation with an image 429 * 430 * @param $product431 * 432 * @return bool 433 * 434 * @since 1.5.2467 * Checks if the product has a variation with an image. 468 * 469 * @param WC_Product $product The product object to check. 470 * 471 * @return bool True if product has variations with images, false otherwise. 472 * 473 * @since 1.5.2 435 474 */ 436 475 private function product_has_variation_images($product): bool { … … 447 486 return false; 448 487 } 488 489 /** 490 * Disable the default WooCommerce product thumbnail. 491 * 492 * Removes the default WooCommerce product thumbnail from the shop loop 493 * to prevent conflicts with the gallery swiper. 494 * 495 * @since 1.5.8 496 */ 497 public function disable_default_thumbnail() { 498 remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 ); 499 } 500 501 /** 502 * Parse the breakpoint value from the settings. 503 * 504 * This function converts the breakpoint setting to an integer and validates it. 505 * 506 * @param string $breakpoint The breakpoint value from the settings. 507 * 508 * @return int|null The parsed breakpoint value or null if invalid. 509 * 510 * @since 1.1.0 511 */ 512 private function parse_breakpoint( $breakpoint ) { 513 $value = intval( $breakpoint ); 514 515 return $value > 0 ? $value : null; 516 } 517 518 /** 519 * Wrap content in a Swiper slide div. 520 * 521 * Creates a div element with the swiper-slide class and wraps the provided content. 522 * 523 * @param string $content The content to wrap in the slide. 524 * 525 * @return string The HTML for the Swiper slide with content. 526 * 527 * @since 1.5.8 528 */ 529 public function wrap_in_slide( $content ) { 530 $extra_classes = apply_filters( 'wdevs_gallery_swiper_slide_extra_classes', '' ); 531 $slide_classes = trim( 'swiper-slide ' . $extra_classes ); 532 return '<div class="' . esc_attr( $slide_classes ) . '">' . $content . '</div>'; 533 } 534 535 /** 536 * Render gallery with default thumbnail as first slide. 537 * 538 * This method is used as a callback for theme/plugin compatibility adjustments 539 * where the default gallery rendering needs to be replaced with a version 540 * that includes the default thumbnail as the first slide. 541 * 542 * @since 1.5.8 543 */ 544 public function render_gallery_with_default_thumbnail() { 545 $this->render_full_gallery( true ); 546 } 449 547 } -
product-gallery-swiper-for-woocommerce/trunk/wdevs-gallery-swiper.php
r3333160 r3333374 17 17 * Plugin URI: https://products.wijnberg.dev 18 18 * Description: Enhances WooCommerce product images display on product listing sections, providing a responsive and touch-friendly swiper. 19 * Version: 1.5. 719 * Version: 1.5.8 20 20 * Author: Wijnberg Developments 21 21 * License: GPL-2.0+ … … 41 41 * Rename this for your plugin and update it as you release new versions. 42 42 */ 43 define( 'WDEVS_GALLERY_SWIPER_VERSION', '1.5. 7' );43 define( 'WDEVS_GALLERY_SWIPER_VERSION', '1.5.8' ); 44 44 45 45 /**
Note: See TracChangeset
for help on using the changeset viewer.