false,
'orderby' => 'date',
'order' => 'DESC',
'paged' => $paged
);
$args = aspen_setup_post_args($args); // setup custom fields for this page
$wp_query = new WP_Query(apply_filters('aspen_pwp_wp_query',$args)); // reuse $wp_query to make paging work
// now, put the infobar
if ( aspen_getopt('infobar_location') == 'top' )
get_template_part('infobar'); // This will use the global $aspen_crumbs instead of "current" version
$aspen_crumbs = false; // IMPORTANT - need to clear the global now for the rest of the world
echo $page_part1; // and now the page post
if ( aspen_getopt('infobar_location') == 'content' )
get_template_part('infobar'); // This will use the global $aspen_crumbs instead of "current" version
echo $page_part2; // and now the page post
if ( have_posts() ) { // same loop as index.php
global $aspen_sticky;
aspen_content_nav( 'nav-above' );
$sticky_posts = false;
// really ugly kludge. This code is copied from WP's WP_Query code. If you specify filters,
// then the sticky post code is essentially ignored by WP, so we have to do this ourselves.
// So - if there are sticky posts, we have to move them to the top of the posts list, and
// manually add 'sticky' to the post's class. (1/11/12)
if (!aspen_is_checked_page_opt('pp_hide_sticky')
&& (aspen_get_per_page_value('pp_category')
|| aspen_get_per_page_value('pp_tag')
)) { // move sticky posts when cat or tag filters?
// Put sticky posts at the top of the posts array
$sticky_posts = get_option('sticky_posts');
global $page;
if ($page <= 1 && is_array($sticky_posts) && !empty($sticky_posts)) {
$num_posts = count($wp_query->posts);
$sticky_offset = 0;
// Loop over posts and relocate stickies to the front.
for ( $i = 0; $i < $num_posts; $i++ ) {
if ( in_array($wp_query->posts[$i]->ID, $sticky_posts) ) {
$sticky_post = $wp_query->posts[$i];
// Remove sticky from current position
array_splice($wp_query->posts, $i, 1);
// Move to front, after other stickies
array_splice($wp_query->posts, $sticky_offset, 0, array($sticky_post));
// Increment the sticky offset. The next sticky will be placed at this offset.
$sticky_offset++;
}
}
}
}
/* Start the Loop */
$num_cols = aspen_getopt('blog_cols'); // default
$pp = aspen_get_per_page_value('wvr_pwp_cols');
if ($pp) $num_cols = $pp;
if (!$num_cols || $num_cols > 3) $num_cols = 1;
$sticky_one = aspen_getopt_checked( 'blog_sticky_one' ) && $paged <= 1;
$first_one = aspen_getopt_checked( 'blog_first_one' ) && $paged <= 1;
$masonry_wrap = false; // need this for one-column posts
$col = 0;
$hide_n_posts = aspen_get_per_page_value('pp_hide_n_posts');
if ($hide_n_posts == '' || $hide_n_posts < 1 || $hide_n_posts > 100)
$hide_n_posts = 0;
aspen_post_count_clear();
while ( have_posts() ) {
the_post();
aspen_post_count_bump();
if ( aspen_post_count() <= $hide_n_posts ) {
global $page, $paged;
if ( !($paged >= 2 || $page >= 2) )
continue; // skip posting
}
$aspen_sticky = false;
if (is_array($sticky_posts) && !empty($sticky_posts) && in_array( get_the_ID(), $sticky_posts )) {
$aspen_sticky = true;
}
if ( (is_sticky() || $aspen_sticky) && $sticky_one) {
get_template_part( 'content', get_post_format() );
} else if ( $first_one ) {
get_template_part( 'content', get_post_format() );
$first_one = false;
} else {
if (!$masonry_wrap) {
$masonry_wrap = true;
if (aspen_masonry('begin-posts'))
$num_cols = 1; // force to 1 cols
}
aspen_masonry('begin-post'); // wrap each post
switch ($num_cols) {
case 1:
get_template_part( 'content', get_post_format() );
$sticky_one = false;
break;
case 2:
echo ('
' . "\n");
get_template_part( 'content', get_post_format() );
echo ("
\n");
$col++;
if ( !($col % 2) ) { // force stuff to be even
echo "
\n";
}
$sticky_one = false;
break;
case 3:
echo ('
' . "\n");
get_template_part( 'content', get_post_format() );
echo ("
\n");
$col++;
if ( !($col % 3) ) { // force stuff to be even
echo "
\n";
}
$sticky_one = false;
break;
default:
get_template_part( 'content', get_post_format() );
$sticky_one = false;
} // end switch $num_cols
aspen_masonry('end-post');
}
} // end while have posts
aspen_masonry('end-posts');
aspen_content_nav( 'nav-below' );
} else {
aspen_not_found_search(__FILE__);
}
// every thing done, so allow comments?
// comments_template( '', true );
?>