__( 'Display the most recent posts from a single category','mythemeshop' ) ) ); } public function form( $instance ) { $defaults = array( 'comment_num' => 1, 'date' => 1, 'show_thumb1' => 1, 'show_excerpt' => 1, 'excerpt_length' => 10 ); $instance = wp_parse_args((array) $instance, $defaults); $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : __( 'Featured Category','mythemeshop' ); $cat = isset( $instance[ 'cat' ] ) ? intval( $instance[ 'cat' ] ) : 0; $qty = isset( $instance[ 'qty' ] ) ? intval( $instance[ 'qty' ] ) : 5; $comment_num = isset( $instance[ 'comment_num' ] ) ? intval( $instance[ 'comment_num' ] ) : 1; $date = isset( $instance[ 'date' ] ) ? intval( $instance[ 'date' ] ) : 1; $show_thumb1 = isset( $instance[ 'show_thumb1' ] ) ? intval( $instance[ 'show_thumb1' ] ) : 1; $show_excerpt = isset( $instance[ 'show_excerpt' ] ) ? esc_attr( $instance[ 'show_excerpt' ] ) : 1; $excerpt_length = isset( $instance[ 'excerpt_length' ] ) ? intval( $instance[ 'excerpt_length' ] ) : 10; ?>

'ID', 'order' => 'ASC', 'show_count' => 1, 'hide_empty' => 1, 'hide_if_empty' => true, 'echo' => 1, 'selected' => $cat, 'hierarchical' => 1, 'name' => $this->get_field_name( 'cat' ), 'id' => $this->get_field_id( 'cat' ), 'taxonomy' => 'category', ) ); ?>

'; while ( $posts->have_posts() ) { $posts->the_post(); ?>
  • '')); ?> <?php the_title(); ?>
    % '.__('Comments','mythemeshop'));?>

  • '."\r\n"; } } //add_action( 'widgets_init', create_function( '', 'register_widget( "single_category_posts_widget" );' ) ); add_action('widgets_init', function(){return register_widget("single_category_posts_widget");});