Treehouse: Grow your CSS skills. Land your dream job.

Most recent post plugin with title, date & excerpt.

  • # June 24, 2010 at 10:12 am

    I am looking for a wordpress plugin OR just a way to do the following.

    I want on the home page an area that lists off the 2 or 3 most recent post. I want it to show the Title and date as well as the text that is put into the excerpt field of the posts. Does anyone know of how I can do this?

    The closest i have found is a plugin called "Recent Posts with Excerpts " It works great but does NOT have the date. wonder if I could modify this! I know how to get the PHP for the date in there.. but dont know how to have it tie in to displaying of the 3 most recent posts.

    # June 24, 2010 at 12:31 pm

    No need for a plugin here, super simple loop! It’ll look something like this:

    < ?php query_posts('posts_per_page=3'); ?>

    < ?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

    “>< ?php the_title(); ?>

    Posted on: < ?php the_date(); ?>

    < ?php the_excerpt(); ?>

    < ?php endwhile; ?>

    # June 25, 2010 at 9:59 am

    Thanks so much! that worked great.

    I am now wanting to put a link to …read more. and am having a tough time getting it placed right after the (.) at the end of each excerpt/.
    The way this loop works it seem to automatically put <p> tags around the excerpt and I dont know where to find that to add this snippet of code for "read more" Does that make sense?

    When I put it in there it puts in below everything of that excerpt and pushes down into the next one. I want it to flow right with the text of the excert but just be a link like you see most of the time.

    # June 25, 2010 at 12:51 pm

    You could try doing this, though I haven’t tested it:


    < ?php wp_trim_excerpt() ?> – “>Your Read More Text…

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.