<?php if ( ! defined( 'ABSPATH' ) ) { die( 'Direct access forbidden.' ); }

/**
 * @var $before_widget
 * @var $after_widget
 * @var $title
 *
 * @var $post_number
 * @var $cat
 * @var $order
 */

echo wishbone_pass_html( $before_widget );
if($title):
	echo wishbone_pass_html( $title );
endif;
?>

<?php 

/**
 * The WordPress Query class.
 * @link http://codex.wordpress.org/Function_Reference/WP_Query
 *
 */
$args = array(
    'posts_per_page' => $post_number,          
    'cat' => $cat,          
    'ignore_sticky_posts' => 1,          
    'orderby' => $order,          
);
$recentposts = new WP_Query( $args );
if( $recentposts->have_posts() ): ?>
	<ul class="wishbone_widget_recentposts">
		<?php 
		$i=0;
		while( $recentposts->have_posts() ): 
			$recentposts->the_post();
		 ?>
		<?php if( 0 == $i && 'yes' == $firstbig ){ ?>
			<li class="wishbone_recpost_big">
				<a href="<?php the_permalink(); ?>">
				<?php 
				if(has_post_thumbnail()){
			        the_post_thumbnail( 'wishbone_wishbonegridsmall' );
			    } 
				 ?>
				</a>
				<span class="rp_date"><?php the_category(', ' ); ?></span>
				<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="wishbone_recpostboigtitle"><?php the_title(); ?></a>
			</li>
		<?php 
		} else {
		?>
			<li>
				<a href="<?php the_permalink(); ?>">
				<?php 
					if(has_post_thumbnail()){
				        the_post_thumbnail( 'wishbone_eighty' );
			   		} 
				 ?>
				</a>
				<div class="wishbone_recpost_detail">
					<span class="rp_date"><?php the_category(', ' ); ?></span>
					<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="wishbone_recpostsmalltitle"><?php the_title(); ?></a>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
			</li>

		<?php
			} 
		$i++;
		endwhile;
		wp_reset_postdata();
		?>
	</ul>
    <?php
endif;
 ?>
<?php echo wishbone_pass_html( $after_widget ); ?>