widget_cssclass = 'widget_125x125_advertisement'; $this->widget_description = esc_html__( 'Add your 125x125 Advertisement here', 'colormag' ); $this->widget_name = esc_html__( 'TG: 125x125 Advertisement', 'colormag' ); $this->settings = array( 'title' => array( 'type' => 'text', 'default' => '', 'label' => esc_html__( 'Title:', 'colormag' ), ), 'image_addition_label' => array( 'type' => 'custom', 'default' => '', 'label' => esc_html__( 'Add your Advertisement 125x125 Images Here', 'colormag' ), ), '125x125_image_link_1' => array( 'type' => 'url', 'default' => '', 'label' => esc_html__( 'Advertisement Image Link ', 'colormag' ) . 1, ), '125x125_image_url_1' => array( 'type' => 'image', 'default' => '', 'label' => esc_html__( 'Advertisement Image ', 'colormag' ) . 1, ), '125x125_image_link_2' => array( 'type' => 'url', 'default' => '', 'label' => esc_html__( 'Advertisement Image Link ', 'colormag' ) . 2, ), '125x125_image_url_2' => array( 'type' => 'image', 'default' => '', 'label' => esc_html__( 'Advertisement Image ', 'colormag' ) . 2, ), '125x125_image_link_3' => array( 'type' => 'url', 'default' => '', 'label' => esc_html__( 'Advertisement Image Link ', 'colormag' ) . 3, ), '125x125_image_url_3' => array( 'type' => 'image', 'default' => '', 'label' => esc_html__( 'Advertisement Image ', 'colormag' ) . 3, ), '125x125_image_link_4' => array( 'type' => 'url', 'default' => '', 'label' => esc_html__( 'Advertisement Image Link ', 'colormag' ) . 4, ), '125x125_image_url_4' => array( 'type' => 'image', 'default' => '', 'label' => esc_html__( 'Advertisement Image ', 'colormag' ) . 4, ), '125x125_image_link_5' => array( 'type' => 'url', 'default' => '', 'label' => esc_html__( 'Advertisement Image Link ', 'colormag' ) . 5, ), '125x125_image_url_5' => array( 'type' => 'image', 'default' => '', 'label' => esc_html__( 'Advertisement Image ', 'colormag' ) . 5, ), '125x125_image_link_6' => array( 'type' => 'url', 'default' => '', 'label' => esc_html__( 'Advertisement Image Link ', 'colormag' ) . 6, ), '125x125_image_url_6' => array( 'type' => 'image', 'default' => '', 'label' => esc_html__( 'Advertisement Image ', 'colormag' ) . 6, ), ); parent::__construct(); } /** * Output widget. * * @see WP_Widget * * @param array $args Arguments. * @param array $instance Widget instance. */ public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', isset( $instance['title'] ) ? $instance['title'] : '' ); $image_array = array(); $link_array = array(); for ( $i = 1; $i < 7; $i ++ ) { $image_link = isset( $instance[ '125x125_image_link_' . $i ] ) ? $instance[ '125x125_image_link_' . $i ] : ''; $image_url = isset( $instance[ '125x125_image_url_' . $i ] ) ? $instance[ '125x125_image_url_' . $i ] : ''; array_push( $link_array, $image_link ); array_push( $image_array, $image_url ); } $this->widget_start( $args ); ?> '; echo $output; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped } ?> widget_end( $args ); } }