Hello,
i try to setup a yearly (grouped by month) archive for custom post types in WordPress. But my code did not work as aspected. Maybe it is obiviously for someone who is more familar with WordPress and PHP but i can't get it work.
The code below is grouping by month but each post type by itself. Maybe i need to merge booth. But how?
<?php query_posts (array ('post_type' => array('images', 'articles')));?>
<?php
if (have_posts()) : while (have_posts()) : the_post();
// save month to a variable
$month = the_date('M', '', '', FALSE);
// If not used before print it
if ($month != $m_check) {
echo "<h2>" . $month . "</h2>";
}
// save month to check variable
$m_check = $month;
?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br/>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query();?>
Regards, Steve