Archive

<?php
$previous_year = $year = 0;
$previous_month = $month = 0;
$ul_open = false;

query_posts( array( 'posts_per_page' =--------> -1, 'post_status' =&gt; 'publish' ) );
if( have_posts() ):
while( have_posts() ):
the_post();

$year = get_the_time('Y');
$month = get_the_time('n');
$day = get_the_time('j');
if($year != $previous_year || $month != $previous_month) :
if($ul_open == true) :
echo '

';
endif;
echo '
<h3>'.get_the_time('F Y').'</h3>
';
echo '
<ul class="month_archive">';
$ul_open = true;
endif;
$previous_year = $year; $previous_month = $month;

echo '
 	<li><a href="';
    the_permalink();
    echo '">';
the_title();
echo '</a></li>
';
endwhile;
echo '</ul>
';
endif;
wp_reset_query();
?>

No comments yet

Comments are closed at this time.