'widget_contact_info', 'description' => esc_html__( 'Contact information', 'a13_framework_cpt' ) ); parent::__construct( 'contact-info', esc_html__( 'Contact information', 'a13_framework_cpt' ), $widget_ops ); $this->alt_option_name = 'widget_contact_info'; add_action( 'save_post', array( &$this, 'flush_midget_cache' ) ); add_action( 'deleted_post', array( &$this, 'flush_midget_cache' ) ); add_action( 'switch_theme', array( &$this, 'flush_midget_cache' ) ); } function widget( $args, $instance ) { $before_widget = $after_widget = $before_title = $after_title = ''; $cache = wp_cache_get( 'widget_contact_info', 'widget' ); if ( ! is_array( $cache ) ) { $cache = array(); } if ( isset( $cache[ $args['widget_id'] ] ) ) { print $cache[ $args['widget_id'] ]; return; } ob_start(); extract( $args ); $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? esc_html__( 'Contact information', 'a13_framework_cpt' ) : $instance['title'], $instance, $this->id_base ); print $before_widget; if ( $title ) { print $before_title . $title . $after_title; } echo '
'widget_shortcodes', 'description' => esc_html__( 'Widget to put shortcodes in', 'a13_framework_cpt' ) ); $control_ops = array( 'width' => 400, 'height' => 350 ); parent::__construct( 'a13-shortcodes', esc_html__( 'Shortcodes', 'a13_framework_cpt' ), $widget_ops, $control_ops ); } function widget( $args, $instance ) { $before_widget = $after_widget = $before_title = $after_title = ''; extract( $args ); $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance ); print $before_widget; if ( ! empty( $title ) ) { print $before_title . $title . $after_title; } ?> '', 'text' => '' ) ); $title = strip_tags( $instance['title'] ); $text = esc_textarea( $instance['text'] ); ?>
/>
'widget_a13_social_icons', 'description' => esc_html__( 'Social icons form theme settings', 'a13_framework_cpt' ) ); parent::__construct( 'a13-social-icons', esc_html__( 'Apollo13 Social Icons', 'a13_framework_cpt' ), $widget_ops ); $this->alt_option_name = 'widget_a13_social_icons'; add_action( 'save_post', array( &$this, 'flush_midget_cache' ) ); add_action( 'deleted_post', array( &$this, 'flush_midget_cache' ) ); add_action( 'switch_theme', array( &$this, 'flush_midget_cache' ) ); } function widget( $args, $instance ) { $before_widget = $after_widget = $before_title = $after_title = ''; $cache = wp_cache_get( 'widget_a13_social_icons', 'widget' ); if ( ! is_array( $cache ) ) { $cache = array(); } if ( isset( $cache[ $args['widget_id'] ] ) ) { print $cache[ $args['widget_id'] ]; return; } ob_start(); extract( $args ); $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); //without theme function it is useless, as icons come from theme settings if(function_exists('apollo13framework_social_icons')){ $icons = apollo13framework_social_icons( $instance['icons_color'], $instance['icons_color_hover'] ); if ( strlen( $icons ) ) : print $before_widget; if ( $title ) { print $before_title . $title . $after_title; } print $icons; print $after_widget; endif; } $cache[ $args['widget_id'] ] = ob_get_flush(); wp_cache_set( 'widget_a13_social_icons', $cache, 'widget' ); } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags( $new_instance['title'] ); $instance['icons_color'] = $new_instance['icons_color']; $instance['icons_color_hover'] = $new_instance['icons_color_hover']; $this->flush_midget_cache(); $alloptions = wp_cache_get( 'alloptions', 'options' ); if ( isset( $alloptions['widget_a13_social_icons'] ) ) { delete_option( 'widget_a13_social_icons' ); } return $instance; } function flush_midget_cache() { wp_cache_delete( 'widget_a13_social_icons', 'widget' ); } function form( $instance ) { $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; $color = isset( $instance['icons_color'] ) ? esc_attr( $instance['icons_color'] ) : ''; $color_hover = isset( $instance['icons_color_hover'] ) ? esc_attr( $instance['icons_color_hover'] ) : ''; $options = array( 'black' => esc_html__( 'Black', 'a13_framework_cpt' ), 'color' => esc_html__( 'Color', 'a13_framework_cpt' ), 'white' => esc_html__( 'White', 'a13_framework_cpt' ), 'semi-transparent' => esc_html__( 'Semi transparent', 'a13_framework_cpt' ), ); ?>