Listar links de artigos agrupados por ano
-
Pessoal, estou tentando fazer uma listagens de links artigos de uma determinada categoria agrupados por ano.
EX:
2010
– artigo5
– artigo4
– artigo32009
– artigo2
– artigo2Tentei personalizar um código e não consegui.
to tentando assim:<?php foreach($myposts as $post) : ?> <?php // Setup the post variables setup_postdata($post); $year = mysql2date('Y', $post->post_date); $month = mysql2date('n', $post->post_date); ?> <?php if($year != $previous_year ) : ?> <?php if($ul_open == true) : ?> </ul> <h3><?php the_time('Y'); ?></h3> <?php if $month != $previous_month : ?> <ul> <?php $ul_open = true; ?> <?php endif; ?> <?php //$previous_year = $year; $previous_month = $month; ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></li> <?php endif; ?> <?php endforeach; ?> </ul>
Alguém sabe como resolvo?
Visualizando 8 respostas - 1 até 8 (de um total de 8)
Visualizando 8 respostas - 1 até 8 (de um total de 8)
- O tópico ‘Listar links de artigos agrupados por ano’ está fechado para novas respostas.