<?php
$category = get_the_category();
$current_category = $category[0]->term_id;
$qarr = array(
'posts_per_page' => $posts_number,
'cat' => $current_category,
'tag' => 'pinned', // this is the tag that it filters
'post__not_in' => array(get_the_ID())
);
$q = new WP_Query($qarr);
if($q->have_posts()) : while ($q->have_posts()) : $q->the_post();
?>
<div class="block-post clearfix">
<?php
$thumb = '';
$width = 287;
$height = 162;
$classtext = 'post-image';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,'Recent');
$thumb = $thumbnail["thumb"];
?>
<?php if($thumb <> '' && get_option('aggregate_thumbnails_index') == 'on') { ?>
<div class="thumb">
<a href="<?php the_permalink(); ?>">
<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>
<span class="overlaybig"></span>
</a>
</div> <!-- end .post-thumbnail -->
<?php } ?>
<div class="recenttitle"><h3 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3></div>
</div> <!-- end .block-post -->
<?php endwhile; endif;?>