Base.class.php
5 years ago
View.Slide.UPCP.class.php
4 years ago
View.Slide.URP.class.php
4 years ago
View.Slide.WooCommerce.class.php
4 years ago
View.Slide.class.php
4 years ago
View.Slider.class.php
4 years ago
View.class.php
4 years ago
View.Slide.WooCommerce.class.php
60 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Class to display a slide in the slider on the front end. |
| 5 | * |
| 6 | * @since 2.0.0 |
| 7 | */ |
| 8 | class ewdusViewSlideWooCommerce extends ewdusViewSlide { |
| 9 | |
| 10 | /** |
| 11 | * Get the content (image, title, etc.) of the slide |
| 12 | * |
| 13 | * @since 2.0.0 |
| 14 | */ |
| 15 | public function get_slide_content() { |
| 16 | |
| 17 | if ( empty( $this->ID ) ) { return; } |
| 18 | |
| 19 | $wc_product_id = get_post_meta( $this->ID, "EWD_US_WC_Product_ID", true ); |
| 20 | |
| 21 | // If this is a slide that has been assigned a product, load the product |
| 22 | if ( $wc_product_id ) { |
| 23 | |
| 24 | $post = get_post( $wc_product_id ); |
| 25 | |
| 26 | if ( ! $post ) { return; } |
| 27 | |
| 28 | $this->title = $post->post_title; |
| 29 | $this->filtered_content = str_replace( ']]>', ']]>', apply_filters( 'the_content', $post->post_content ) ); |
| 30 | $this->post_thumbnail_id = get_post_thumbnail_id( $post->ID ); |
| 31 | $this->image_url = $this->post_thumbnail_id ? wp_get_attachment_url( $this->post_thumbnail_id ) : $this->image_url; |
| 32 | } |
| 33 | else { |
| 34 | |
| 35 | parent::get_slide_content(); |
| 36 | } |
| 37 | |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Get the initial slide css classes |
| 42 | * @since 2.0.0 |
| 43 | */ |
| 44 | public function slide_classes( $classes = array() ) { |
| 45 | |
| 46 | $parent_classes = parent::slide_classes(); |
| 47 | |
| 48 | $classes = array_merge( |
| 49 | $classes, |
| 50 | $parent_classes, |
| 51 | array( |
| 52 | 'woocommerce_slide' |
| 53 | ) |
| 54 | ); |
| 55 | |
| 56 | return apply_filters( 'us_slide_classes', $classes, $this ); |
| 57 | } |
| 58 | |
| 59 | } |
| 60 |