esc_html__('A widget that promote you busincess', 'sparklestore') )); } private function widget_fields() { $fields = array( 'sparklestore_full_promo_page' => array( 'sparklestore_widgets_name' => 'sparklestore_full_promo_page', 'sparklestore_widgets_title' => esc_html__('Select Promo Page', 'sparklestore'), 'sparklestore_widgets_field_type' => 'selectpage' ), 'sparklestore_full_promo_button_text' => array( 'sparklestore_widgets_name' => 'sparklestore_full_promo_button_text', 'sparklestore_widgets_title' => esc_html__('Enter First Button Text', 'sparklestore'), 'sparklestore_widgets_field_type' => 'text', ), 'sparklestore_full_promo_button_link' => array( 'sparklestore_widgets_name' => 'sparklestore_full_promo_button_link', 'sparklestore_widgets_title' => esc_html__('Enter First Button Link', 'sparklestore'), 'sparklestore_widgets_field_type' => 'url', ), 'sparklestore_full_promo_button_one_text' => array( 'sparklestore_widgets_name' => 'sparklestore_full_promo_button_one_text', 'sparklestore_widgets_title' => esc_html__('Enter Second Button Text', 'sparklestore'), 'sparklestore_widgets_field_type' => 'text', ), 'sparklestore_full_promo_button_one_link' => array( 'sparklestore_widgets_name' => 'sparklestore_full_promo_button_one_link', 'sparklestore_widgets_title' => esc_html__('Enter Second Button Link', 'sparklestore'), 'sparklestore_widgets_field_type' => 'url', ), 'block_promo_layout' => array( 'sparklestore_widgets_name' => 'block_promo_layout', 'sparklestore_widgets_title' => esc_html__( 'Select Block Products Type', 'sparklestore' ), 'sparklestore_widgets_default' => 'fullbg', 'sparklestore_widgets_field_type' => 'select', 'sparklestore_widgets_field_options' => array( 'fullbg' => esc_html__('Full Width Background', 'sparklestore'), 'boxedbg' => esc_html__('Boxed Background', 'sparklestore') ) ), 'sparklestore_promo_info' => array( 'sparklestore_widgets_name' => 'sparklestore_promo_info', 'sparklestore_widgets_title' => esc_html__('Check to Disable Promo Information', 'sparklestore'), 'sparklestore_widgets_field_type' => 'checkbox', ), ); return $fields; } public function widget($args, $instance) { extract($args); extract($instance); $block_promo_id = empty( $instance['sparklestore_full_promo_page'] ) ? '' : $instance['sparklestore_full_promo_page']; $button_link = empty( $instance['sparklestore_full_promo_button_link'] ) ? '' : $instance['sparklestore_full_promo_button_link']; $button_text = empty( $instance['sparklestore_full_promo_button_text'] ) ? '' : $instance['sparklestore_full_promo_button_text']; $button_one_link = empty( $instance['sparklestore_full_promo_button_one_link'] ) ? '' : $instance['sparklestore_full_promo_button_one_link']; $button_one_text = empty( $instance['sparklestore_full_promo_button_one_text'] ) ? '' : $instance['sparklestore_full_promo_button_one_text']; $promo_layout = empty( $instance['block_promo_layout'] ) ? 'fullbg' : $instance['block_promo_layout']; $promo_info = empty( $instance['sparklestore_promo_info'] ) ? '' : $instance['sparklestore_promo_info']; echo $before_widget; if( !empty( $block_promo_id ) ) { $block_promo_page = new WP_Query( 'page_id='.$block_promo_id ); if( $block_promo_page->have_posts() ) { while( $block_promo_page->have_posts() ) { $block_promo_page->the_post(); $full_promo_image = wp_get_attachment_image_src( get_post_thumbnail_id() , 'full', true ); if( !empty( $block_promo_layout ) && $block_promo_layout == 'fullbg' ){ ?>