The publish date of WordPress articles disappears which are made on the same day! How to fix?
As you write your articles with WordPress, you might have noticed that if you have made more than one posts on the same day, the publish date of the post disappears (when you loop them into your theme)! That’s really disappointing if you want to see the publish date of every post. SO, how to fix that?
You need to use the_time() -function!
As you just read, you need to use the_time() function (in the WordPress loop) instead of the_date(). That will fix the date disappearing problem. Don’t believe me, look:
<?php query_posts(array( $args ); ?> <?php while ( have_posts()): the_post(); ?> <article> <h2><a href='<?php echo get_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h2> <p><?php the_time('d.m.Y'); ?></p> //don't use the_date('d.m.Y'); <p><?php echo get_the_excerpt(); ?></p> </article> <?php wp_reset_postdata(); ?> <?php endwhile; ?>
That’s it folks! All done. Going to sleep!