How to: Post Excerpt with Image? (4 posts)

  1. apertureboy
    Posted 10 years ago #

    Hi all,

    Ive been searching the forums for an answer on how to get the 5 most recent posts with an image attached. Each of my posts always has an image under the title. I would like the 5 most recent posts to display with the image attached, and the excerpt below the image.

    The code below works fine to pull the title, author, date and excerpt, but how can I get the image to appear as well. Is this possible? Ive tried a few plugins and playing with the PHP but cant seem to get it working...any thoughts?


    <?php $arc_query = new WP_Query('orderby=post_date&order=DESC&showposts=5'); ?>
    <?php while ($arc_query->have_posts()) : $arc_query->the_post(); ?>
    <h1>" rel="bookmark">
    <?php the_title(); ?>

    <h3><?php the_time('F jS, Y') ?> <span class="by">by</span><span class="author"> <?php the_author() ?> </span></h3>
    <?php the_excerpt(); ?>
    <?php endwhile; ?>

  2. Chris_K
    Posted 10 years ago #

    Have a look at this plugin: http://guff.szub.net/2005/02/26/the-excerpt-reloaded/

    the_excerpt() strips tags. The plugin will allow tags you specify (such as <img>) to not be stripped.

  3. Michael Bishop

    Posted 10 years ago #

    The easiest way I know of is to use Kaf's excerpt reloaded plugin. http://guff.szub.net/2005/02/26/the-excerpt-reloaded/

    You can specify what tags can be used in the excerpt, ie, <a><img>

    I recently did that on my personal site. (I even do thumbnails on the front page, and full size images on the single page (Quick tutorial on how I did it)

  4. apertureboy
    Posted 10 years ago #


    Thanks for the help. I did get it working by using the_content(); and applying the "More tag" but Ill try the excerpt reloaded plugin.


Topic Closed

This topic has been closed to new replies.

About this Topic