Title: Adding post date in Recent-posts plugin
Last modified: August 19, 2016

---

# Adding post date in Recent-posts plugin

 *  [DarioDN](https://wordpress.org/support/users/dariodn/)
 * (@dariodn)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/adding-post-date-in-recent-posts-plugin/)
 * I’m going to insert the date in the list post.
    I used this code: $date = $post-
   >post_date; and then echo it by the output.
 * The date is printed like YYYY-MM-DD HH:mm … how can I print it as DD-MM-YYYY 
   etc?
 * tnx for reply

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [jzahlaway](https://wordpress.org/support/users/jzahlaway/)
 * (@jzahlaway)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/adding-post-date-in-recent-posts-plugin/#post-687005)
 * Where *exactly* did you put your code in order to get the date echo?
 *  [jzahlaway](https://wordpress.org/support/users/jzahlaway/)
 * (@jzahlaway)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/adding-post-date-in-recent-posts-plugin/#post-687006)
 * Nevermind.
 * In case anyone is interested, here’s what I did to solve this for myself:
 * In wp-content/themes/[theme in use]/index.php, the following line is what causes
   the date to appear below the heading for each individual post:
 * `<small><?php the_time('F j, Y') ?> <!-- by <?php the_author() ?> --></small>`
 * I copied that and pasted it into wp-includes/widgets.php after this (somewhere
   around line 908, according to my HTML editor):
    `<li><a href="<?php the_permalink()?
   >"><?php if ( get_the_title() ) the_title(); else the_ID(); ?> </a>`
 * I also added a linebreak so that the date appears beneath its respective article
   heading in the “Recent Posts” block. So, altogether, this is the line that now
   appears in wp-includes/widgets.php:
 * `<li><a href="<?php the_permalink() ?>"><?php if ( get_the_title() ) the_title();
   else the_ID(); ?> </a><small><?php the_time('F j, Y') ?> <!-- by <?php the_author()?
   > --></small></li>`

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding post date in Recent-posts plugin’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [jzahlaway](https://wordpress.org/support/users/jzahlaway/)
 * Last activity: [17 years, 11 months ago](https://wordpress.org/support/topic/adding-post-date-in-recent-posts-plugin/#post-687006)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
