'agency_ecommerce_widget_call_to_action', 'description' => esc_html__('Call To Action Widget', 'agency-ecommerce'), ); parent::__construct('agency-ecommerce-cta', esc_html__('AE - Call To Action', 'agency-ecommerce'), $opts); } function widget_fields() { $content_position = array( 'left' => __('Left', 'agency-ecommerce'), 'right' => __('Right', 'agency-ecommerce'), 'center' => __('Center', 'agency-ecommerce'), ); $content_style = array( 'style-1' => __('Style 1', 'agency-ecommerce'), 'style-2' => __('Style 2', 'agency-ecommerce'), 'style-3' => __('Style 3', 'agency-ecommerce') ); $fields = array( 'title' => array( 'name' => 'title', 'title' => esc_html__('Title', 'agency-ecommerce'), 'type' => 'text', 'default' => esc_html__('CTA title', 'agency-ecommerce'), ), 'sub_title' => array( 'name' => 'sub_title', 'title' => esc_html__('Sub Title', 'agency-ecommerce'), 'type' => 'text', ), 'discount_percent' => array( 'name' => 'discount_percent', 'title' => esc_html__('Discount', 'agency-ecommerce'), 'type' => 'text', 'default' => '25%', ), 'offer_text' => array( 'name' => 'offer_text', 'title' => esc_html__('Offer Text', 'agency-ecommerce'), 'type' => 'text', 'default' => __('OFF', 'agency-ecommerce'), ), 'content_position' => array( 'name' => 'content_position', 'title' => esc_html__('Content Position', 'agency-ecommerce'), 'type' => 'select', 'default' => 'right', 'options' => $content_position, ), 'content_style' => array( 'name' => 'content_style', 'title' => esc_html__('Content Style', 'agency-ecommerce'), 'type' => 'select', 'default' => 'style-2', 'options' => $content_style, ), 'button_text' => array( 'name' => 'button_text', 'title' => esc_html__('Button Text', 'agency-ecommerce'), 'type' => 'text', 'default' => __('Buy Now', 'agency-ecommerce'), ), 'button_url' => array( 'name' => 'button_url', 'title' => esc_html__('Button URL', 'agency-ecommerce'), 'type' => 'text', 'default' => 'https://mantrabrain.com/' ), 'background_image' => array( 'name' => 'background_image', 'title' => esc_html__('Background Image', 'agency-ecommerce'), 'type' => 'image', ), 'parallax_background' => array( 'name' => 'parallax_background', 'title' => esc_html__('Parallax Background', 'agency-ecommerce'), 'type' => 'checkbox', ) ); return $fields; } /** * 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) { $valid_widget_instance = Agency_Ecommerce_Widget_Validation::instance()->validate($instance, $this->widget_fields()); $title = apply_filters('widget_title', empty($valid_widget_instance['title']) ? '' : $valid_widget_instance['title'], $valid_widget_instance, $this->id_base); $parallax_background = (boolean)($valid_widget_instance['parallax_background']); $parallax_background_class = $parallax_background ? 'mb-parallax' : ''; if (!empty($valid_widget_instance["background_image"])) { $background_style = ''; $background_style .= ' style="background-image:url(' . esc_url($valid_widget_instance["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']; ?>
">
' . esc_html($valid_widget_instance["discount_percent"]) . ''; } if (!empty($valid_widget_instance["offer_text"])) { echo '' . esc_html($valid_widget_instance["offer_text"]) . ''; } ?>
' . esc_html($valid_widget_instance['sub_title']) . '

'; } ?>