widget_cssclass = 'bloglex-image-widget'; $this->widget_description = __("The Image Widget offers versatile design with two style variations. Effortlessly incorporate images, titles, descriptions, and links for dynamic and engaging content presentation in a single widget.", 'bloglex'); $this->widget_id = 'bloglex_image_widget'; $this->widget_name = __('Bloglex: Image Widget', 'bloglex'); $this->settings = $this->get_widget_settings(); parent::__construct(); } /** * Define widget settings. */ protected function get_widget_settings() { return array( 'title' => array( 'type' => 'text', 'label' => __('Widget Title', 'bloglex'), ), 'title_text' => array( 'type' => 'text', 'label' => __('Widget Description', 'bloglex'), ), 'bg_image' => array( 'type' => 'image', 'label' => __('Background Image', 'bloglex'), ), 'btn_text' => array( 'type' => 'text', 'label' => __('Button Text', 'bloglex'), ), 'btn_link' => array( 'type' => 'url', 'label' => __('Link to URL', 'bloglex'), 'desc' => __('Please make sure to provide a complete URL that includes either "http://" or "https://" to ensure the widget operates correctly.', 'bloglex'), ), 'link_target' => array( 'type' => 'checkbox', 'label' => __('Open Link in new Tab', 'bloglex'), 'std' => true, ), 'text_alignment' => array( 'type' => 'select', 'label' => __('Text Alignment', 'bloglex'), 'options' => array( 'align-text-center' => __('Center', 'bloglex'), 'align-text-left' => __('Left', 'bloglex'), 'align-text-right' => __('Right', 'bloglex'), ), 'std' => 'align-text-center', ), 'style' => array( 'type' => 'select', 'label' => __('Style', 'bloglex'), 'options' => array( 'style_1' => __('Style 1', 'bloglex'), 'style_2' => __('Style 2', 'bloglex'), ), 'std' => 'style_1', ), ); } /** * Output widget. * * @param array $args * @param array $instance * @see WP_Widget * */ public function widget($args, $instance) { $class = ''; ob_start(); echo $args['before_widget']; $class .= $instance['style']; $class .= ' ' . $instance['text_alignment']; do_action('bloglex_before_image'); ?>