10, 'type' => 'filter', 'callback' => array( $this, 'post_thumbnail_html' ), 'args' => 4 ); $hooks['before_title']['archive_slide']['post_thumbnail_html'] = array( 'priority' => 9, 'type' => 'filter', 'callback' => array( $this, 'post_thumbnail_html_title' ), 'args' => 4, 'js' => array( '.wpsf-product-title', 'prepend' ) ); $hooks['on_image']['archive_slide']['sp_wpspro_product_image'] = array( 'priority' => 10, 'type' => 'filter' ); $hooks['before_title']['archive_slide']['sp_wpspro_product_image'] = array( 'priority' => 9, 'type' => 'filter', 'js' => array( '.wpsf-product-title', 'prepend' ) ); return $hooks; } /* * Display on_image labels */ public function post_thumbnail_html( $html, $post_id, $post_thumbnail_id, $size ) { $is_slider = $this->is_inside_slider(); if ( $is_slider ) { $html = $html . AWL_Label_Display::instance()->show_label( 'on_image' ); } return $html; } /* * Display before_title labels */ public function post_thumbnail_html_title( $html, $post_id, $post_thumbnail_id, $size ) { $is_slider = $this->is_inside_slider(); if ( $is_slider ) { $html = $html . AWL_Label_Display::instance()->show_label( 'before_title' ); } return $html; } /* * Is slider condition */ private function is_inside_slider() { $is_slider = false; foreach ( debug_backtrace() as $trace_part ) { if ( isset( $trace_part['class'] ) && in_array( $trace_part['class'], array( 'SP_WPS_ShortCode', 'ShapedPlugin\WooProductSlider\Frontend\Frontend' ) ) ) { $is_slider = true; break; } } return $is_slider; } /* * Add addition styles */ public function wp_footer_styles() { echo ''; } /* * Add custom container selector for js hooks */ public function awl_js_container_selectors( $product_container ) { $product_container[] = '.wpsf-product'; return $product_container; } } endif; AWL_SP_Slider::instance();