'optimizer_front_about aboutblock', 'description' => __( 'Optimizer About Section widget', 'optimizer' ), 'customize_selective_refresh' => true, ) ); $this->alt_option_name = 'optimizer_front_about'; add_action('wp_enqueue_scripts', array(&$this, 'optimizer_about_enqueue_css')); } /* ---------------------------- */ /* ------- Display Widget -------- */ /* ---------------------------- */ function widget( $args, $instance ) { extract( $args ); /* Our variables from the widget settings. */ $title = isset( $instance['title'] ) ? wp_kses_post($instance['title']) : __('THE OPTIMIZER','optimizer'); $subtitle = isset( $instance['subtitle'] ) ? wp_kses_post($instance['subtitle']) : __('a little about..','optimizer'); $content = isset( $instance['content'] ) ? apply_filters( 'wp_editor_widget_content', $instance['content'] ) : '

'.__('Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI.','optimizer').'

'; $divider = isset( $instance['divider'] ) ? esc_html($instance['divider']) : 'fa-stop'; $title_color = isset( $instance['title_color'] ) ? esc_html($instance['title_color']) : '#222222'; $content_color = isset( $instance['content_color'] ) ? esc_html($instance['content_color']) : '#a8b4bf'; $content_bg = isset( $instance['content_bg'] ) ? esc_html($instance['content_bg']) : '#ffffff'; /* Before widget (defined by themes). */ echo $before_widget; if(is_customize_preview()) echo ''.$this->name.''; echo '
'; if ( isset($subtitle) ){ echo ''.do_shortcode($subtitle).''; } if ( !empty($title) ){ echo '

'.do_shortcode($title).'

'; } if ( $divider ){ if( $divider !== 'no_divider'){ if($divider == 'underline'){ $underline= 'title_underline';}else{$underline='';} echo '
'; } } if ( $content ){ echo '
'.do_shortcode($content).'
'; } echo '
'; /* After widget (defined by themes). */ echo $after_widget; } /* ---------------------------- */ /* ------- Update Widget -------- */ /* ---------------------------- */ function update( $new_instance, $old_instance ) { $instance = $old_instance; /* Strip tags for title and name to remove HTML (important for text inputs). */ $instance['title'] = wp_kses_post( $new_instance['title'] ); /* No need to strip tags */ $instance['subtitle'] = wp_kses_post($new_instance['subtitle']); $instance['content'] = wp_kses_post($new_instance['content']); $instance['divider'] = wp_kses_post($new_instance['divider']); $instance['title_color'] = optimizer_sanitize_hex($new_instance['title_color']); $instance['content_color'] = optimizer_sanitize_hex($new_instance['content_color']); $instance['content_bg'] = optimizer_sanitize_hex($new_instance['content_bg']); return $instance; } /* ---------------------------- */ /* ------- Widget Settings ------- */ /* ---------------------------- */ /** * Displays the widget settings controls on the widget panel. * Make use of the get_field_id() and get_field_name() function * when creating your form elements. This handles the confusing stuff. */ function form( $instance ) { /* Set up some default widget settings. */ $defaults = array( 'title' => __('THE OPTIMIZER','optimizer'), 'subtitle' => __('a little about..','optimizer'), 'content' => __('Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI.','optimizer'), 'divider' => 'fa-stop', 'title_color' => '#222222', 'content_color' => '#a8b4bf', 'content_bg' => '#ffffff', ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

" type="text" />

" type="text" />

option_name ); if ( empty( $settings ) ) { return; } foreach ( $settings as $instance_id => $instance ) { $id = $this->id_base . '-' . $instance_id; if ( ! is_active_widget( false, $id, $this->id_base ) ) { continue; } $content_bg = 'background-color:#ffffff!important;'; $title_color = '#222222;'; $content_color = 'color:#a8b4bf;'; if ( ! empty( $instance['content_bg'] ) ) { $content_bg = 'background-color: ' . esc_html($instance['content_bg']) . '!important; '; } if ( ! empty( $instance['title_color'] ) ) { $title_color = '' . esc_html($instance['title_color']) . '!important; '; } if ( ! empty( $instance['content_color'] ) ) { $content_color = 'color: ' . esc_html($instance['content_color']) . '!important; '; } $widget_style = '#'.$id.'{ ' . $content_bg . '}#'.$id.' .about_header, #'.$id.' .about_pre, #'.$id.' span.div_middle{color: ' . $title_color . '}#'.$id.' span.div_left, #'.$id.' span.div_right{background-color: ' . $title_color . '}#'.$id.' .about_content{' . $content_color . '}'; wp_add_inline_style( 'optimizer-style', $widget_style ); } } //END FOREACH } ?>