'widgets_of_posts_by_same_categories', 'description' => __('The widget area lists posts of the same category as the current post.')); $control_ops = array('width' => 400); $this->WP_Widget('of_posts_by_same_categories', __('Posts by Same Categories'), $widget_ops, $control_ops); } /** @see WP_Widget::widget */ function widget($args, $instance) { extract( $args ); if (is_single()) { $number_of_posts_to_show_by_categories = $instance['number_of_posts_to_show_by_categories']; $orderby = $instance['orderby']; $order = $instance['order']; $display_link = $instance['display_link']; $separator = $instance['separator']; $exclude_categories = explode (",", $instance['exclude_categories']); $exclude_posts = get_the_ID(); if (!$number_of_posts_to_show_by_categories) { $number_of_posts_to_show_by_categories = 5;} ?> cat_ID; foreach ( $exclude_categories as $exclude_category ) { if( $cat_ID == $exclude_category ){ continue 2; } } if( $category->count <= 1 ){ continue; } $numberposts = $number_of_posts_to_show_by_categories; ?>

: /