'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']) : ''; $content_position = !empty($instance['content_position']) ? esc_attr($instance['content_position']) : 'left'; $content_style = !empty($instance['content_style']) ? esc_attr($instance['content_style']) : 'style-1'; $button_text = !empty($instance['button_text']) ? esc_html($instance['button_text']) : ''; $button_url = !empty($instance['button_url']) ? esc_url($instance['button_url']) : ''; $background_image = !empty($instance['background_image']) ? esc_url($instance['background_image']) : ''; $parallax_background = !empty($instance['parallax_background']) ? (boolean)($instance['parallax_background']) : 0; $parallax_background_class = $parallax_background ? 'mb-parallax' : ''; // Add background image. if (!empty($background_image)) { $background_style = ''; $background_style .= ' style="background-image:url(' . esc_url($background_image) . ');" '; $args['before_widget'] = implode($background_style . ' ' . 'class="bg_enabled ' . $parallax_background_class . ' ', 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'), 'content_position' => 'left', 'content_style' => 'style-1', 'button_text' => esc_html__('Purchase Now', 'agency-ecommerce'), 'button_url' => '', 'background_image' => '', 'parallax_background' => 0, )); $background_image = ''; if (!empty($instance['background_image'])) { $background_image = $instance['background_image']; } $wrap_style = ' style="max-width:100%;" '; if (empty($background_image)) { $wrap_style = ' style="display:none; max-width:100%;" '; } $image_status = false; if (!empty($background_image)) { $image_status = true; } $delete_button = 'display:none;'; if (true === $image_status) { $delete_button = 'display:inline-block;'; } ?>
dropdown_content_position(array( 'id' => $this->get_field_id('content_position'), 'name' => $this->get_field_name('content_position'), 'selected' => esc_attr($instance['content_position']), ) ); ?>
dropdown_content_style(array( 'id' => $this->get_field_id('content_style'), 'name' => $this->get_field_name('content_style'), 'selected' => esc_attr($instance['content_style']), ) ); ?>
id="get_field_id('parallax_background'); ?>" name="get_field_name('parallax_background'); ?>"/>
'', 'name' => '', 'selected' => 'left', ); $r = wp_parse_args($args, $defaults); $output = ''; $choices = apply_filters('agency_ecommerce_cta_widget_content_position', array( 'left' => esc_html__('Left', 'agency-ecommerce'), 'right' => esc_html__('Right', 'agency-ecommerce'), 'center' => esc_html__('Center', 'agency-ecommerce'), )); if (!empty($choices)) { $output = "\n"; } echo $output; } function dropdown_content_style($args) { $defaults = array( 'id' => '', 'name' => '', 'selected' => 'style-1', ); $r = wp_parse_args($args, $defaults); $output = ''; $choices = apply_filters('agency_ecommerce_cta_widget_content_style', array( 'style-1' => esc_html__('Style One', 'agency-ecommerce'), 'style-2' => esc_html__('Style Two', 'agency-ecommerce'), )); if (!empty($choices)) { $output = "\n"; } echo $output; } } endif;