thomas514
Member
Posted 1 year ago #
Hi, I want to list archives menu yearly and monthly on my website, which means to use wp_get_archives I guess but I want to show years and below each year, I would like months listed, like so:
2011
august
july
june
may
april
mars
february
january
2010
april
mars
february
january
etc.
Any idea how to do that?
thomas514
Member
Posted 1 year ago #
Thanks for the reply keesiemeijer!
But I have this error message when I add the follofing code:
<?php query_posts('posts_per_page = -1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$Year= get_the_date( 'Y' );
$Month = get_the_date( 'F' );
$Day = get_the_date( 'j' );
?>
<?php if($Year != $temp_year) : ?>
<h2><?php echo $Year ?></h2>
<?php endif; ?>
<?php if($Month != $temp_month || $Year != $temp_year) : ?>
<h3><?php echo $Month; ?></h3>
<?php endif; ?>
<li><span><?php echo $Day; ?></span><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php
$temp_year = $Year;
$temp_month = $Month;
?>
<?php endwhile; endif; ?>
Fatal error: Call to undefined function get_the_date()