widget_cssclass = 'blogmarks_ads_code_widget'; $this->widget_description = __( 'Advertisements or codes widget.', 'blogmarks' ); $this->widget_id = 'blogmarks_ads_code_widget'; $this->widget_name = __( 'Blogmarks: Ads Code', 'blogmarks' ); $this->settings = array( 'ads_code' => array( 'type' => 'textarea', 'label' => __( 'Ads Code', 'blogmarks' ), ), 'align' => array( 'type' => 'select', 'label' => __( 'Alignment', 'blogmarks' ), 'options' => array( 'left' => __( 'Left', 'blogmarks' ), 'center' => __( 'Center', 'blogmarks' ), 'right' => __( 'Right', 'blogmarks' ), 'strecth' => __( 'Stretch', 'blogmarks' ), ), 'std' => 'center', ), 'hide_on_desktop' => array( 'type' => 'checkbox', 'label' => __( 'Hide on Desktop', 'blogmarks' ), 'std' => false, ), 'hide_on_tablet' => array( 'type' => 'checkbox', 'label' => __( 'Hide on Tablet', 'blogmarks' ), 'std' => false, ), 'hide_on_mobile' => array( 'type' => 'checkbox', 'label' => __( 'Hide on Mobile', 'blogmarks' ), 'std' => false, ), ); parent::__construct(); } /** * 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']; echo wp_kses_post( $before_widget ); $ad_class = ''; if ( isset( $instance['hide_on_desktop'] ) && $instance['hide_on_desktop'] ) { $ad_class .= ' hide-on-desktop'; } if ( isset( $instance['hide_on_tablet'] ) && $instance['hide_on_tablet'] ) { $ad_class .= ' hide-on-tablet'; } if ( isset( $instance['hide_on_mobile'] ) && $instance['hide_on_mobile'] ) { $ad_class .= ' hide-on-mobile'; } do_action( 'blogmarks_before_ads_code' ); if ( isset( $instance['ads_code'] ) && $instance['ads_code'] ) { ?>