10, 'type' => 'filter', 'callback' => array( $this, 'woocommerce_product_get_image' ), 'args' => 3 ); $hooks['before_title']['archive']['woocommerce_product_title'] = array( 'priority' => 10, 'type' => 'filter', 'callback' => array( $this, 'woocommerce_product_title' ), 'args' => 2 ); $hooks['before_title']['archive']['martfury_woo_shop_loop_item_title'] = array( 'priority' => 5 ); $hooks['before_title']['single']['martfury_single_product_summary'] = array( 'priority' => 4 ); $hooks['before_title']['single']['martfury_single_product_deal_summary'] = array( 'priority' => 4 ); return $hooks; } /* * Add labels for 'on image' position */ public function woocommerce_product_get_image( $image, $obj, $size ) { if ( isset( $this->data['show_labels'] ) && $this->data['show_labels'] ) { $image = '
' . $image . AWL_Label_Display::instance()->show_label( 'on_image' ) . '
'; } return $image; } /* * Add labels for 'before title' position */ public function woocommerce_product_title( $name, $product ) { if ( isset( $this->data['show_labels'] ) && $this->data['show_labels'] ) { $name = AWL_Label_Display::instance()->show_label( 'before_title' ) . $name; } return $name; } function before_render( $block ) { $name = $block->get_name(); $add_to = array( 'martfury-recently-viewed-products-carousel' ); if ( array_search( $name, $add_to ) !== false ) { $this->data['show_labels'] = true; } } function after_render( $block ) { $this->data['show_labels'] = false; } } endif; AWL_Martfury::instance();