[Plugin: Advanced Most Recent Posts] Display post's date (4 posts)

  1. Giorgos Sarigiannidis
    Posted 6 years ago #


    I use the Advanced Most Recent Posts plugin and I was wondering if I could display each post's date (and preferably time as well).

    Based on this discussion I tried
    $excerpt = ': ' . $excerpt . ' ' . get_the_date();
    on line 198 of the .php file.

    Unfortunately, it didn't display the publication date of each post but instead, it keeps repeating one particular date (which happens to be the date I created the WP blog).

    Any ideas about how I could get the post's date / time displayed in my list?

    Thank you in advance

  2. brucehere365
    Posted 6 years ago #

    I'm also looking for this...

    If anyone could help out that'd be great.

  3. Yup, you can try something like this, just edit it as needed:

    $time = date('m/d/y',strtotime($post->post_date));
    $excerpt = ' (' . $time . '): ' . $excerpt;
  4. QueenNola
    Posted 5 years ago #

    If you want to do it without using a plugin but within a template for example you can do it this way:

    in the template file:

     $postslist = get_posts('numberposts=3&order=DESC&orderby=date');
     foreach ($postslist as $post) :
     <div class="entry">
     <h3><?php the_title(); ?></h3>
     <?php the_excerpt(); ?>
     <?php endforeach; ?>

    Just change the number of posts of 3 to how ever you want.

    and in the functions file to reduce the excerpt length limit from the default of 55

    add_filter('excerpt_length', 'my_excerpt_length');
    function my_excerpt_length($length) {
    return 20; }

    just change the number 20 to what you want, I used 20.

Topic Closed

This topic has been closed to new replies.

About this Topic