PluginProbe
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More / 2.1.0
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More v2.1.0
2.3.0 2.2.0 2.1.1 2.1.0 2.0.0 1.10.0 1.9.1 1.9.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 All 59 releases
storeengine / includes / shortcode / single-product-gallery.php

single-product-gallery.php in StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More 2.1.0, at includes/shortcode/single-product-gallery.php

50 lines 927 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace StoreEngine\Shortcode;
4
5 use StoreEngine\Utils\Template;
6
7 class SingleProductGallery {
8
9 public function __construct() {
10 add_shortcode( 'storeengine_single_product_gallery', [ $this, 'render' ] );
11 }
12
13 public function render( array $attrs ) {
14 $attributes = shortcode_atts( [
15 'product_id' => 0,
16 ], $attrs );
17
18 $product_id = absint( $attributes['product_id'] );
19 if ( ! $product_id ) {
20 $product_id = get_the_ID();
21 }
22 if ( ! $product_id ) {
23 return '';
24 }
25
26 wp_enqueue_style(
27 'flickity',
28 STOREENGINE_ASSETS_URI . 'library/flickity/flickity.min.css',
29 [],
30 STOREENGINE_VERSION,
31 null
32 );
33 wp_enqueue_script(
34 'flickity',
35 STOREENGINE_ASSETS_URI . 'library/flickity/flickity.pkgd.min.js',
36 [],
37 STOREENGINE_VERSION,
38 true
39 );
40
41 ob_start();
42 Template::get_template( 'single-product/gallery.php', [
43 'product_id' => $product_id,
44 ] );
45
46 return ob_get_clean();
47 }
48
49 }
50