render_wrapper( 'banner', $this->render_template() ); } /** * Render Template */ public function render_template() { $image_bg = $this->attribute['sg_banner_image']; $image_bg_size = $this->attribute['sg_banner_image_size_imagesize_size']; $image_src = ! empty( $image_bg['id'] ) ? wp_get_attachment_image_src( $image_bg['id'], $image_bg_size ) : $image_bg['url']; $subtitle = '
' . esc_attr( $this->attribute['sg_banner_subtitle'] ) . '
'; $title = '

' . esc_attr( $this->attribute['sg_banner_title'] ) . '

'; $description = $this->attribute['sg_banner_show_description'] === 'yes' ? '
' . $this->attribute['sg_banner_description'] . '
' : ''; $before_box_sale_text = '
' . esc_attr( $this->attribute['sg_box_sale_before_text'] ) . '
'; $box_sale_unit = '' . esc_attr( $this->attribute['sg_box_sale_unit'] ) . ''; $box_sale_text = '
' . esc_attr( $this->attribute['sg_box_sale_text'] ) . $box_sale_unit . '
'; $button_link = ''; if ( $this->attribute['sg_button_text'] ) { $button_text = $this->attribute['sg_button_text']; if ( 'icon' === $this->attribute['sg_button_icon_type'] ) { $icon = $this->render_icon_element( $this->attribute['sg_button_icon'] ); if ( 'before' === $this->attribute['sg_button_icon_position'] ) { $button_text = sprintf( '%s%s', $icon, $this->attribute['sg_button_text'] ); } else { $button_text = sprintf( '%s%s', $this->attribute['sg_button_text'], $icon ); } } $button_link = $this->render_url_element( $this->attribute['sg_button_link'], null, 'jkit-banner-button-link', $button_text ); } $box_sale_class = sprintf( 'jkit-box-sale-position-%s jkit-box-sale-position-%s', $this->attribute['st_box_sale_horizontal_orientation'], $this->attribute['st_box_sale_vertical_orientation'] ); $image = sprintf( '
', esc_url( is_array( $image_src ) ? $image_src[0] : $image_src ) ); $content = '
' . $subtitle . $title . $description . $button_link . '
'; $box_sale = '
' . $before_box_sale_text . $box_sale_text . '
'; $type_link = ( 'all' === $this->attribute['sg_link_type'] ) ? $this->render_url_element( $this->attribute['sg_button_link'], null, 'jkit-banner-all-link' ) : ''; $wrapper = '
' . $image . $content . $box_sale . $type_link . '
'; return wp_kses_post( $wrapper ); } }