Reputation: 3
I've been trying to put H5 and H6 tags to the recent posts using query post, but Wordpress doesn't want to apply them correctly. It seems to apply them only to the first result, but on the rest, it just discards the second item of the list.
I'm going to paste the sidebar.php and some lines of the style.css. I will greatly appreciate your help. I've been fiddling with this for three hours now with no luck.
www.estamosobservando.com
<div id="widget">
<h3>Latest posts</h3>
<?php query_posts('posts_per_page=3'); if (have_posts()) : while (have_posts()) : the_post();?>
<ul>
<li><h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5></li>
<li><h6><?php the_date(); ?></h6></li>
</ul>
<?php endwhile; endif; ?>
#widget { padding: 133px 0px 0px 20px; text-align:left; }
#widget ul {margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; list-style-type:none; list-style-image: none; text-decoration: none;}
#widget li { margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; list-style-type:none; list-style-image: none; text-decoration: none; }
Upvotes: 0
Views: 136
Reputation: 33749
All three of your latest posts are from today, May 30.
From the WordPress docs:
SPECIAL NOTE: When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()). To repeat the date for posts published under the same day, you should use the Template Tag the_time() or get_the_date() (since 3.0) with a date-specific format string.
Alternatively, you could succumb to how the_date
works, and modify your layout a little to effectively have the date as a heading that encompasses all posts for that date.
Upvotes: 2