'agency_ecommerce_widget_call_to_action', 'description' => esc_html__( 'Call To Action Widget', 'agency-ecommerce' ), ); parent::__construct( 'agency-ecommerce-cta', esc_html__( 'AE: CTA', 'agency-ecommerce' ), $opts ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $sub_title = ! empty( $instance['sub_title'] ) ? esc_html( $instance['sub_title'] ) : ''; $offer_percent = ! empty( $instance['offer_percent'] ) ? esc_html( $instance['offer_percent'] ) : ''; $offer_text = ! empty( $instance['offer_text'] ) ? esc_html( $instance['offer_text'] ) : ''; $button_text = ! empty( $instance['button_text'] ) ? esc_html( $instance['button_text'] ) : ''; $button_url = ! empty( $instance['button_url'] ) ? esc_url( $instance['button_url'] ) : ''; $bg_pic = ! empty( $instance['bg_pic'] ) ? esc_url( $instance['bg_pic'] ) : ''; // Add background image. if ( ! empty( $bg_pic ) ) { $background_style = ''; $background_style .= ' style="background-image:url(' . esc_url( $bg_pic ) . ');" '; $args['before_widget'] = implode( $background_style . ' ' . 'class="bg_enabled ', explode( 'class="', $args['before_widget'], 2 ) ); }else{ $args['before_widget'] = implode( 'class="bg_disabled ', explode( 'class="', $args['before_widget'], 2 ) ); } echo $args['before_widget']; ?>
'', 'sub_title' => '', 'offer_percent' => esc_html__( '50%', 'agency-ecommerce' ), 'offer_text' => esc_html__( 'OFF', 'agency-ecommerce' ), 'button_text' => esc_html__( 'Purchase Now', 'agency-ecommerce' ), 'button_url' => '', 'bg_pic' => '', ) ); $bg_pic = ''; if ( ! empty( $instance['bg_pic'] ) ) { $bg_pic = $instance['bg_pic']; } $wrap_style = ''; if ( empty( $bg_pic ) ) { $wrap_style = ' style="display:none;" '; } $image_status = false; if ( ! empty( $bg_pic ) ) { $image_status = true; } $delete_button = 'display:none;'; if ( true === $image_status ) { $delete_button = 'display:inline-block;'; } ?>