Veja como fazer para puxar todos os posts de uma determinada categoria, exibindo em listas agrupadas por meses, assim:
Julho 2010
- Titulo do post
- Titulo do post
Junho 2010
- Titulo do post
- Titulo do post
Vejamos:
[sourcecode language=”php”]
< ?php
$args=array(
'tag' => ‘tag1’,
‘posts_per_page’ => -1,
‘post_status’ => ‘publish’,
‘orderby’ => ‘date’,
‘order’ => ‘DESC’,
‘caller_get_posts’ =>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
$ymdate = ”;
while ($my_query->have_posts()) : $my_query->the_post();
$ympost = mysql2date(“M Y”, $post->post_date);
if ( $ympost != $ymdate) {
$ymdate = $ympost;
echo ‘
Artigos do mes: ‘ . $ymdate . ‘
‘;
}
?>
< ?php the_time('F jS, Y') ?>
[/sourcecode]
[sourcecode language=”css”]
[/sourcecode]
[sourcecode language=”php”]
< ?php
$args=array(
'cat' => ’12’,
‘posts_per_page’ => -1,
‘post_status’ => ‘publish’,
‘orderby’ => ‘date’,
‘order’ => ‘ASC’,
‘caller_get_posts’ =>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
$ymdate = ”;
while ($my_query->have_posts()) : $my_query->the_post();
$ympost = mysql2date(“F Y”, $post->post_date);
if ( $ympost != $ymdate) {
$ymdate = $ympost;
echo ‘
‘.$ymdate.’
‘;
echo ‘
- ‘;
- < ?php the_title(); ?>
-
- < ?php the_content(); ?>
}?>
< ?php endwhile; echo '
‘;
} wp_reset_query();
?>
[/sourcecode]
Perfeito!!!
Nossa me ajudou muito esse tuto *-* Valeu!