'blogged-category-posts' ); $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'blogged-category-posts-widget' ); $this->WP_Widget( 'blogged-category-posts-widget',theme_name .' - Category Posts', $widget_ops, $control_ops ); } function widget( $args, $instance ) { extract( $args ); $title = ''; $no_of_posts = ''; $cats_id = ''; if( !isset( $title )) { $title = apply_filters('widget_title', $instance['cat_posts_title'] ); } if( !isset( $no_of_posts )) { $no_of_posts = $instance['no_of_posts']; } if( !isset( $cats_id )) { $cats_id = $instance['cats_id']; } echo $before_widget; if ( $title){ echo $before_title; echo $title ; echo $after_title;} ?>
__( 'Category Posts' , 'blogged'), 'no_of_posts' => '5' , 'cats_id' => '1' ); $instance = wp_parse_args( (array) $instance, $defaults ); $categories_obj = get_categories(); $categories = array(); foreach ($categories_obj as $pn_cat) { $categories[$pn_cat->cat_ID] = $pn_cat->cat_name; } ?>