• Hi All,

    I will like to be able to recent posts titles with date in html li format.

    I am using the wp_get_archives tag as follows:

    wp_get_archives('type=postbypost&limit=10');

    I just want to be able to display the post date as well.

    Does anyone know of an extension or plugin I could use.

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • One solution:

    <?php
        $args=array(
          'post_type' => 'post',
          'post_status' => 'publish',
          'posts_per_page' => -1,
          'caller_get_posts'=> 1
          );
        $my_query = null;
        $my_query = new WP_Query($args);
        if( $my_query->have_posts() ) {
          echo 'List of Posts';
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <p><?php the_time('m.d.y') ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
           <?php
          endwhile;
        }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

    There are couple of them just search for “recent posts” in the plugin gallery


    [sig moderated per forum rules]

    The solution from MichaelH is fine, but it shows all my recent posts. What to change if I want to display only the last 3 posts.

    Hello,

    Im using this code and it works very good! I list the last 10 posts with it.
    Now i want a link to list older posts. Does somebody know how to do that? I would be very happy! 🙂

    @ Yasp0: change the 10 in my code to 3

    <?php
        $args=array(
          'post_type' => 'post',
          'post_status' => 'publish',
          'posts_per_page' => 10,
          'caller_get_posts'=> 1
          );
        $my_query = null;
        $my_query = new WP_Query($args);
        if( $my_query->have_posts() ) {
          echo '';
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <li><a class="sidebar" href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a><h5 class="postdate"><?php the_time('d.m.y') ?></h5></li>
           <?php
          endwhile;
        }
    wp_reset_query();
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display recent post titles with date’ is closed to new replies.