I am trying to figure out a way to get monthly archives and group them by category.
Category 1
August 11
July 11
June 11
Category 2
August 11
July 11
June 11
Category 3
August 11
July 11
June 11
Brian
I am trying to figure out a way to get monthly archives and group them by category.
Category 1
August 11
July 11
June 11
Category 2
August 11
July 11
June 11
Category 3
August 11
July 11
June 11
Brian
I found this code which essentially groups the posts by category... The more i look for what i'm trying to do, the more i think it can't be done.
<?php
$cat_args = array(
'orderby' => 'name',
'order' => 'ASC',
'child_of' => 0
);
$categories = get_categories($cat_args);
foreach($categories as $category) {
echo '<dl>';
echo '<dt> <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></dt>';
$post_args = array(
'numberposts' => 5,
'category' => $category->term_id
);
$posts = get_posts($post_args);
foreach($posts as $post) {
?>
<dd><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></dd>
<?php
}
echo '<dd class="view-all"> <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>View all posts in ' . $category->name.'</a></dd>';
echo '</dl>';
}
?>This plugin did the trick
Installed it and simple used " <?php wp_get_archives('cat=27,type=monthly'); ?>
This topic has been closed to new replies.