widget_cssclass = 'blogmarks_image_widget'; $this->widget_description = __( 'Displays image and short description', 'blogmarks' ); $this->widget_id = 'blogmarks_image_widget'; $this->widget_name = __( 'Blogmarks: Image Widget', 'blogmarks' ); $this->settings = array( 'title' => array( 'type' => 'text', 'label' => __('Widget Title', 'blogmarks'), ), 'short_description' => array( 'type' => 'text', 'label' => __('Widget Description', 'blogmarks'), ), 'bg_image' => array( 'type' => 'image', 'label' => __('Background Image', 'blogmarks'), ), 'btn_text' => array( 'type' => 'text', 'label' => __('Button Text', 'blogmarks'), ), 'btn_link' => array( 'type' => 'url', 'label' => __('Link to URL', 'blogmarks'), 'desc' => __('Please make sure to provide a complete URL that includes either "http://" or "https://" to ensure the widget operates correctly.', 'blogmarks'), ), 'link_target' => array( 'type' => 'checkbox', 'label' => __('Open Link in new Tab', 'blogmarks'), 'std' => true, ), 'style' => array( 'type' => 'select', 'label' => __('Style', 'blogmarks'), 'options' => array( 'style_1' => __('Style 1', 'blogmarks'), 'style_2' => __('Style 2', 'blogmarks'), ), 'std' => 'style_1', ), ); parent::__construct(); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_assets' ) ); } /** * Output widget. * * @see WP_Widget * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { ob_start(); $before_widget = $args['before_widget']; $after_widget = $args['after_widget']; do_action( 'blogmarks_before_image_widget' ); $widget_class = ''; $short_description = isset( $instance['short_description'] ) ? $instance['short_description'] : ''; $bg_image = isset( $instance['bg_image'] ) ? $instance['bg_image'] : ''; $btn_text = isset( $instance['btn_text'] ) ? $instance['btn_text'] : ''; $btn_link = isset( $instance['btn_link'] ) ? $instance['btn_link'] : ''; $link_target = isset( $instance['link_target'] ) ? $instance['link_target'] : ''; $style = isset( $instance['style'] ) ? $instance['style'] : $this->settings['inverted_block_color']['std']; $widget_class .= ' ' . $style; echo wp_kses_post( $before_widget ); ?>

" class="blogmarks-btn-link style_1">
id_base ) ) { $file_prefix = is_rtl() ? '-rtl' : ''; $css_file = get_template_directory() . '/include/widgets/assets/image-widget' . $file_prefix . '.css'; if ( file_exists( $css_file ) ) { $styles = wp_strip_all_tags( file_get_contents( $css_file ) ); wp_add_inline_style( 'blogmarks-style', $styles ); } } } }