How do i get the date of the posts beside of the postname in a list? i tried it with following code which will show all the post name of the users posts but only the first one gets a date and i guess it is the date of today not of the post itself.
<!-- the loop -->
<?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?><?php the_date(); ?></a></li>
<?php endwhile; ?>
<!-- end of the loop -->
whereas this code posts the name of the post and the content for each one of them. is that with the date a bug?
<ul>
<!-- the loop -->
<?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?><?php the_content(); ?></a></li>
<?php endwhile; ?>
<!-- end of the loop -->
</ul>
The function the_date()
will only display once per page per day according to the Wordpress Codex and other posts on Wordpress Development Stack Exchange https://wordpress.stackexchange.com/a/125209. The solution is to use the function get_the_date()
instead.