'kc_widget_content', 'description' => __('Display content is built by KingComposer Page Builder','kingcomposer') ); $control= array( 'width' => 250, 'height' => 350, 'id_base' => 'kc_widget_content' ); parent::__construct('kc_widget_content','KC Content', $widget, $control); } function widget( $args, $instance ) { global $kc, $post, $kc_prevent_infinity_loop; if (!isset($kc_prevent_infinity_loop)) $kc_prevent_infinity_loop = array(); extract( $args ); $title = empty( $instance['title'] ) ? '' : $instance['title']; $title_as = empty( $instance['title_as'] ) ? '' : $instance['title_as']; $id = empty( $instance['id'] ) ? '' : $instance['id']; $class = empty( $instance['class'] ) ? '' : $instance['class']; if (strpos ($id, '#') !== false) { $id = explode('#', $id); $id = trim ($id[1]); if (isset($post) && (is_object($post) && $id == $post->ID) || (isset($kc_prevent_infinity_loop[$id]) && $kc_prevent_infinity_loop[$id] === true)) { echo '
Error: Infinite loop, do not include widget into itself.
'; return false; } $kc_prevent_infinity_loop[$id] = true; if($title_as == 'yes') $title = get_the_title($id); }else{ echo '
Error: Please select a widget content to display
'; return false; } if( !empty( $instance['class'] ) ){ $before_widget = str_replace( 'class="', 'class="'.$class.' ', $before_widget ); } echo $before_widget; if (!empty($title)) { echo $before_title; echo $title; echo $after_title; } echo '
'; echo $kc->do_shortcode( kc_raw_content($id) ); echo '
'; unset ($kc_prevent_infinity_loop[$id]); echo $after_widget; } function update( $new, $old ) { $inst = $old; $inst['title'] = strip_tags( $new['title'] ); $inst['title_as'] = strip_tags( $new['title_as'] ); $inst['id'] = strip_tags( $new['id'] ); $inst['class'] = strip_tags( $new['class'] ); return $inst; } function form( $instance ) { $defaults = array( 'title' => __('KC Widget Content', 'kingcomposer'), 'title_as' => '', 'id' => '', 'class' => '' ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

" class="checkbox" type="checkbox" />

', 's': this.value, 'field_name': 'widget_content' }, function( result ){ rst.html(''); for( n in result ) { if (rst.html() === '') { rid.attr('value', result[n]+' #'+n); } rst.append(''); } } ); " placeholder="" />