• 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)
  • Where *exactly* did you put your code in order to get the date echo?

    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.