widget_cssclass = 'widget_aytias_mailchimp_form'; $this->widget_description = __("Displays MailChimp form if you have any", 'aytias'); $this->widget_id = 'aytias_mailchimp_form'; $this->widget_name = __('Aytias: MailChimp Form', 'aytias'); $this->settings = array( 'title' => array( 'type' => 'text', 'label' => __('Title', 'aytias'), ), 'desc' => array( 'type' => 'textarea', 'label' => __('Description', 'aytias'), 'rows' => 10, ), 'form_shortcode' => array( 'type' => 'text', 'label' => __('MailChimp Form Shortcode', 'aytias'), ), 'style' => array( 'type' => 'select', 'label' => __('Style', 'aytias'), 'options' => array( 'style_1' => __('Style 1', 'aytias'), 'style_2' => __('Style 2', 'aytias'), 'style_3' => __('Style 3', 'aytias'), ), 'std' => 'style_1', ), 'msg' => array( 'type' => 'message', 'label' => __('Additonal Settings', 'aytias'), ), 'bg_image' => array( 'type' => 'image', 'label' => __( 'Background Image', 'aytias' ), 'desc' => __( 'Don\'t upload any image if you do not want to show the background image.', 'aytias' ), ), 'enable_fixed_bg' => array( 'type' => 'checkbox', 'label' => __( 'Enable Fixed Background Image', 'aytias' ), 'std' => true, ), 'bg_overlay_color' => array( 'type' => 'color', 'label' => __( 'Overlay Color', 'aytias' ), 'std' => '#000000', ), 'overlay_opacity' => array( 'type' => 'number', 'step' => 10, 'min' => 0, 'max' => 100, 'std' => 50, 'label' => __('Overlay Opacity (Default 50%)', 'aytias'), ), ); parent::__construct(); } /** * Output widget. * * @see WP_Widget * * @param array $args * @param array $instance */ public function widget($args, $instance) { if (!empty($instance['form_shortcode'])) { ob_start(); $class = ''; $image_enabled = false; $this->widget_start($args, $instance); if($instance['bg_image'] && 0 != $instance['bg_image']){ $image_enabled = true; $class = 'aytias-cover-block '; if($instance['enable_fixed_bg']){ $class .= 'aytias-bg-image aytias-bg-attachment-fixed '; } } $class .= $instance['style']; do_action( 'aytias_before_mailchimp'); ?>
widget_end($args); echo ob_get_clean(); } } }