'widget_post_categories', 'description' => __( 'Use only for single template' , 'cannyon' ) )); } function widget( $args, $instance ) { /* PRINT THE WIDGET */ extract( $args , EXTR_SKIP ); $instance = wp_parse_args( (array) $instance, array( 'title' => '' )); $title = $instance[ 'title' ]; if( is_singular( 'post' ) && has_category( ) ){ echo $before_widget; if( !empty( $title ) ){ echo $before_title; echo apply_filters( 'widget_title', esc_attr( $title ), $instance, $this -> id_base ); echo $after_title; } echo '
'; echo $after_widget; } } function update( $new_instance, $old_instance ) { /* UPATE THE WIDGET OPTIONS */ $instance = $old_instance; $instance[ 'title' ] = esc_attr( strip_tags( $new_instance[ 'title' ] ) ); return $instance; } function form( $instance ) { /* PRINT WIDGET FORM */ $instance = wp_parse_args( (array) $instance, array( 'title' => '' )); $title = $instance[ 'title' ]; echo '

'; echo ''; echo '

'; } } register_widget( 'mythemes_post_categories' ); } /* END IF CLASS EXISTS */ ?>