• Hi,

    I would like to have an excerpt of my recent post listed in the sidebar widget “recent post” Currently it list the title only

    Can anyone help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter chilibird

    (@chilibird)

    thanks emsi, but I want to show excerpts, not just the listed item. is that possible? I found a plugin “recent-post with excerpt” that I am going to try.

    Put this in a PHP Code Widget:

    <?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() ) {
      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></p>
        <?php
        the_excerpt();
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘get recent post’ is closed to new replies.