'tempo_widget_categories', 'description' => __( 'This widget can be used only for single post template', 'sarmys' ) )); } /** * Widget Preview */ function widget( $args, $instance ) { global $post; // extract args extract( $args , EXTR_SKIP ); $instance = wp_parse_args( (array) $instance, array( 'title' => __( 'Post Categories', 'sarmys' ) )); if( is_singular( 'post' ) && has_category( ) ){ echo $before_widget; if( !empty( $instance[ 'title' ] ) ){ echo $before_title; echo apply_filters( 'widget_title', esc_attr( $instance[ 'title' ] ), $instance, $this -> id_base ); echo $after_title; } $categories = tempo_post_categories( $post -> ID ); echo '
'; echo $after_widget; } } /** * Widget Update */ function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance[ 'title' ] = sanitize_text_field( $new_instance[ 'title' ] ); return $instance; } /** * Widget Form ( admin side ) */ function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => null )); echo '

'; echo ''; echo '

'; } } } ?>