jon-b
6/20/2015 - 10:09 PM

page-archive.php

page-archive.php

<?php
/**
 * Template Name: Custom Archive
 */

//* Remove entry meta in entry footer and Genesis loop

add_action( 'genesis_meta', 'minimum_front_page_genesis_meta' );
function minimum_front_page_genesis_meta() {
	remove_action( 'genesis_loop', 'genesis_do_loop' );
	add_action( 'genesis_loop', 'ja_page_archive_content' );
}

// Add custom archive output
function ja_page_archive_content() {

	$post_items = new WP_Query( array( 'post_type'=> 'post', 'showposts' => '99', 'order' => 'DESC', 'orderby' => 'date' ) );
	$set_month = '';
	while ( $post_items->have_posts() ) : $post_items->the_post();
		if ( '' === $set_month ) {
			echo '<div class="ja_archive_page">FIRST<h2>'.get_the_date( 'F' ).' '.get_the_date( 'Y' ).'</h2>';
			echo '<ul>';
			// I don't get why your using M/F to determine this rather than an iterator, but...  
			$set_month = get_the_date( 'F' );  // Set month to full, don't do this again...
		} else {
			if ( get_the_date( 'F' ) != $set_month ) { // If a new month, start a new group....
				echo '</ul></div>';
				echo '<div class="ja_archive_page">LAST<h2>'.get_the_date( 'F' ).' '.get_the_date( 'Y' ).'</h2>';
				echo '<ul>';
				$set_month = get_the_date( 'F' );
			}
		}
		echo '<li><a href="'.get_the_permalink().'"><span class="archive_post_date">'.get_the_date( 'F j, Y' ).'</span>'.get_the_title().'</a></li>';
	endwhile;
}

genesis();