<?php
$category_obj = get_category($content_category_id);
$category_posts = query_posts('category_name='.$category_obj->slug.'&posts_per_page=5');
// Reset Query
wp_reset_query();
//pp_debug($category_posts);

if(!empty($category_posts))
{
?>

<div class="post_wrapper">
    	
    <div class="post_inner_wrapper">
    
    <div class="post_header_wrapper">
        <div class="post_header">
        	<h3>
        		<?php echo $category_obj->name; ?>
        	</h3>
        </div>
    </div>
    
    </div>

</div>

<?php
$image_thumb = '';
    							
if(has_post_thumbnail($category_posts[0]->ID, 'blog_ft'))
{
    $image_id = get_post_thumbnail_id($category_posts[0]->ID);
    $image_thumb = wp_get_attachment_image_src($image_id, 'blog_ft', true);
}
?>

<div class="post_wrapper">
    	
    <div class="post_inner_wrapper">
    
		<div class="one_half"style="float:right;">
        <?php
            if(!empty($image_thumb))
            {
        ?>
        
        <div class="post_img">
            <a href="<?php echo get_permalink($category_posts[0]->ID); ?>" title="<?php echo $category_posts[0]->post_title; ?>">
            	<img src="<?php echo $image_thumb[0]; ?>" alt="" class="home_category_ft"/>
            </a>
        </div>
        
        <?php
            }
        ?>
        </div>
        
        <div class="one_half last"style="float:left;">
        	<h6 style="margin-top:20px; ">
        		<a style="font-family:BYekan;" href="<?php echo get_permalink($category_posts[0]->ID); ?>" title="<?php echo $category_posts[0]->post_title; ?>">
        			<?php echo $category_posts[0]->post_title; ?>
        		</a>
        	</h6>
        	<div class="post_detail space" style="width:100%">
	        	<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/clock.png" class="middle"/>&nbsp;<?php echo _e( 'Posted on', THEMEDOMAIN ); ?>&nbsp;<?php echo date('j F Y', strtotime($category_posts[0]->post_date)); ?>
	    	</div>
	    	<br class="clear"/>
            <?php
            	echo pp_substr(strip_tags(strip_shortcodes($category_posts[0]->post_content)), 120);
            ?>
            <br/><br/>
            <a href="<?php echo get_permalink($category_posts[0]->ID); ?>" class="readmore"style="float:right;"><?php echo _e( 'Read more', THEMEDOMAIN ); ?> &larr; </a>
            <?php 
				$pp_enable_rating = get_option('pp_enable_rating');
				
				if(!empty($pp_enable_rating))
				{
			?>
	            <div class="post_category_rating" style="float:left;">
	            	<?php echo do_shortcode('[ratings id="'.$category_posts[0]->ID.'" results="true"]'); ?>
	            </div>
	        <?php
	        	}
	        ?>
        </div>
        
        <br class="clear"/><br/><br/><hr/><br/>


<?php
foreach($category_posts as $key => $category_post) 

if($key > 0)
{
    $image_thumb = '';
    							
    if(has_post_thumbnail($category_post->ID, 'thumbnail'))
    {
        $image_id = get_post_thumbnail_id($category_post->ID);
        $image_thumb = wp_get_attachment_image_src($image_id, 'thumbnail', true);
    }
?>
    
    <div class="one_half <?php if($key%2 == 0) { ?>last<?php } ?>">
    	<a href="<?php echo get_permalink($category_post->ID); ?>" title="<?php echo $category_posts[0]->post_title; ?>">
    		<img class="alignleft thumb" src="<?php echo $image_thumb[0]; ?>" alt=""/>
    	</a>
    	<a href="<?php echo get_permalink($category_post->ID); ?>" title="<?php echo $category_posts[0]->post_title; ?>">
    		<strong style="font-family:BYekan;"><?php echo $category_post->post_title; ?></strong>
    	</a><br/>
    	<div class="post_detail space">
	    	<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/clock.png" class="middle"/>&nbsp;<?php echo date('j F Y', strtotime($category_post->post_date)); ?>
	    </div>
	    <br class="clear"/>
    </div>
    

<?php 
	if($key%2 == 0) {
?>
	<br class="clear"/>
<?php
	}
}


//end foreach
?>

	</div>
    
</div>
<br class="clear"/>

<?php
		
}
?>