WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] How to add the publishing time to recent posts

[Resolved] How to add the publishing time to recent posts

  • Hi!
    I would like to use something similar to the Recent Posts widget, but I would like to show the time when the post was published after the listed title.

    Can anyone show me in the right direction, thanks!

    -Paul

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php
    //display 10 posts with title and date
    $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 'List of Posts';
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a> - <?php the_time('m.d.y') ?></p>
        <?php
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

    thanks, it looks a bit similar to the solutions I got at the thematic forum (http://themeshaper.com/forums/topic/how-to-show-time-when-listing-recent-posts) which works with the php code widget.

    which works with the php code widget.

    So does the code above…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] How to add the publishing time to recent posts’ is closed to new replies.