<?php
add_action("widgets_init", "tp_populer_widgets");
function tp_populer_widgets() {
    register_widget( 'tp_populer_widget' );
}
class tp_populer_widget extends WP_Widget {
function tp_populer_widget() 
{
    $widget_ops = array( 'classname' => 'widget_tp_populer', 'description' => __('Bu bileşen sayesinde Populer Konular sidebarda gösterilecektir.', 'th') );
    $this->WP_Widget( 'tp_populer_widget', __('Portalium Popüler', 'th'), $widget_ops );
}
function widget( $args, $instance )
{
?>
						<div class="populer  clearfix">
							<div class="comment  clearfix">
								<ul class="tabs clearfix">
									<li>
										<a href="#tab1">POPÜLER</a>
									</li>
									<li>
										<a href="#tab2">YORUMLAR</a>
									</li>
									<li>
										<a href="#tab3">ETİKETLER</a>
									</li>
								</ul>
							</div>
							<ul class="tab_content border" id="tab1">
								<?php 			
									wp_reset_query();			
									query_posts('post_type=post&v_sortby=views&v_orderby=desc&showposts=5&cat='.fs_get_option("fs_habercat"));									
									while ( have_posts() ) : the_post(); 									
								?>	
								<li>
									<a href="<?php the_permalink(); ?>">
										<?php
											if ( has_post_thumbnail()) : 
												the_post_thumbnail( 'populer', array('class' => 'fl-right', 'alt' => ''.get_the_title().'', 'title' => ''.get_the_title().'' )); 
											elseif (get_post_meta($post->ID, 'resim', true) != '') : 
												echo '<img class="fl-right" src="'.get_post_meta($post->ID, 'resim', true).'" alt="'.get_the_title().'" width="56" height="49" />'; 
											else : 
												echo '<img class="fl-right" src="'.fs_get_option('fs_logo').'" alt="'.get_the_title().'" width="56" height="49" />';
											endif;
										?>	
										<strong><?php the_title(); ?></strong> 
										<span><?php echo the_time('j F Y'); ?></span>
									</a>
								</li>
								<?php endwhile; ?>								
							</ul>
							<ul class="tab_content border" id="323">
								<?php
								global $wpdb;
								$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
								comment_post_ID, comment_author, comment_date_gmt, comment_approved,
								comment_type,comment_author_url,
								SUBSTRING(comment_content,1,100) AS com_excerpt
								FROM $wpdb->comments
								LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
								$wpdb->posts.ID)
								WHERE comment_approved = '1' AND comment_type = '' AND
								post_password = ''
								ORDER BY comment_date_gmt DESC
								LIMIT 5";
								$comments = $wpdb->get_results($sql);
								foreach ($comments as $comment) {
								echo'
								<li>								
								<a href="' . get_permalink($comment->ID) .'#comment- '. $comment->comment_ID . '">
									' . get_avatar( $comment, '49' ) . '
									<strong>'.strip_tags($comment->comment_author).'</strong>
									<span>' . strip_tags($comment->com_excerpt).'</span>
								</a>								
								</li>
								';
								}
								?>								
							</ul>
							<ul class="tab_content border" id="tab3">
								<?php $args = array(
									'smallest'                  => 8, 
									'largest'                   => 22,
									'unit'                      => 'pt', 
									'number'                    => 45,  
									'format'                    => 'flat',
									'separator'                 => "\n",
									'orderby'                   => 'name', 
									'order'                     => 'ASC',
									'exclude'                   => null, 
									'include'                   => null, 
									'topic_count_text_callback' => default_topic_count_text,
									'link'                      => 'view', 
									'taxonomy'                  => 'post_tag', 
									'echo'                      => true,
									'child_of'                   => null
								); ?>
								<?php wp_tag_cloud( $args ); ?>
							</ul>
						</div>
<?php
}
function update( $new_instance, $old_instance ) {}
function form( $instance ) 
{
	$instance = wp_parse_args( (array) $instance, $defaults ); 
    echo'     
        <p>
            Bileşenin Ayalarını Tema Panelinden Yapınız!
        </p>
		';
}
}

?>
yukarıdaki kod popiler bölümü için satın aldığım temanın kodudur ancak bunun benim sabit bir katagoriye sabitlemem lazım duyuruları oradan göstermem görekiyor duyuru sistem wordpress katagori id ise 323