Right now I have category titles listed by date like this...
01-01 - Cat Title
02-01 - Cat Title 2
02-01 - Cat Title 2
03-01 - Cat Title 3
The working code for this is ...
$posts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'post',
'order' => 'DESC',
'orderby' => 'date',
'tag' => 'editorial'
));
if( $posts ): ?>
<ul>
<?php
foreach( $posts as $post ): setup_postdata( $post ) ?>
<li>
<div>
<?php
single_cat_title( '', true );
?>
</div>
<div>
<?php echo get_the_date('m-Y');?><?php echo (' - ');?><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</div>
</li>
<?php endforeach; ?>
</ul>
I'd like for the list to look like this when all dates are open...
01-01 - Cat Title
02-01 - Cat Title 2
- Cat Title 2
03-01 - Cat Title 3
And like this when all dates are closed...
01-01
02-01
03-01
There are plenty of plugins that do this but none that list titles with a specific tag, it would be amazing to have this solved.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire