• Resolved gnurf

    (@gnurf)


    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)
  • MichaelH

    (@michaelh)

    <?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().
    ?>
    Thread Starter gnurf

    (@gnurf)

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

    MichaelH

    (@michaelh)

    which works with the php code widget.

    So does the code above…

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