<?php if (!defined('FW')) die('Forbidden'); ?>

<?php
$pagingtype = $postlayout = '';
$pagingtype = $atts['pagingtype'];
$postlayout = $atts['postlayout'];

if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } else if ( get_query_var('page') ) {$paged = get_query_var('page'); } else {$paged = 1; }
$args = array(
	'post_type' => 'post',
	'post_status' => 'publish',
	'paged' => $paged,
);

$posts = new WP_Query( $args );

if( $posts->have_posts() ):
	echo '<div class="wishbone_blogwrapper">';
	if( 'masonry' == $postlayout ){
		echo '<div class="wishbone_msn_posts">';
		echo '<div class="grid-sizer"></div>';
			while( $posts->have_posts() ): $posts->the_post();
				get_template_part('loop', $postlayout);
			endwhile;
		echo '</div>';
	} elseif( 'simplegrid' == $postlayout ) {
		echo '<div class="wishbone_simgrid_posts">';
		echo '<div class="grid-sizer"></div>';
			while( $posts->have_posts() ): $posts->the_post();
				get_template_part('loop', $postlayout);
			endwhile;
		echo '</div>';
	} elseif( 'simplelist' == $postlayout ) {
		while( $posts->have_posts() ): $posts->the_post();
			get_template_part('loop', $postlayout);
		endwhile;
	} elseif( 'classic' == $postlayout ) {
		while( $posts->have_posts() ): $posts->the_post();
			get_template_part('loop', $postlayout);
		endwhile;
	} else {
		while( $posts->have_posts() ): $posts->the_post();
			get_template_part('loop', $postlayout);
		endwhile;
	}

	if( 'loadmore' == $pagingtype ){
		wishbone_ajax_pagination( $postlayout, $posts->max_num_pages );
	} elseif( 'nextprev' == $pagingtype ){
		wishbone_nextprev_pagination( $posts->max_num_pages );
	} else {
		wishbone_pagination( $posts->max_num_pages );
	}

	echo '</div>';

endif;

 ?>
