I'm developing a thematic childtheme. On a subpage, I'm listing posts from a custom post type. By now, all runs perfect, BUT missing ONE feature: I need the posts to be seperated by years, means all 2011 posts are headed by an
<h2>2011</h2>, then come the articles, then comes
<h2>2010</h2>, then come the articles, and so on...all on one page, no pagination.
For better understanding how my current code for the query looks like:
<?php $movies= new WP_Query( array( 'post_type' => 'movies', 'genre' => 'sci-fi', 'paged' => $paged ) ); ?> <?php if ($movies->have_posts()) : ?> <?php while ($movies->have_posts()) : $movies->the_post(); ?><?php $counter++; ?> <article class="item <?php thematic_post_class() ?>"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <h3 class="caption"><?php the_title(); ?></h3> <img src="<?php echo get_bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php print_custom_field('coverbild:to_image_src'); ?>&h=400&w482&zc=1&q=80" /></a> </article><!-- .item --> <?php endwhile; ?> <?php thematic_navigation_below(); ?> <?php endif; ?>
As far as my PHP-knowledge goes, it shouldn't be so hard to get what I need? I really am a patient guy and I'm searching for a solution for 2 weeks now. In some moments I really started to question Wordpress in general, but I know that there's a solution to it, I just didn't find it yet. Does anybody know something usefull? ANY help really is APPRECIATED!