Support » Plugins » Adding Excerpt to Post Lists

  • I have been trying out wp_get_archives and also the CG-SameCat plug-in. Both work well. But I would have liked both of these post lists to have included the_excerpt. Does anyone know of any way to achieve this? Any plug-ins that I have missed or simple code hacks?
    Any help appreciated thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • If you mean using wp_get_archives in ‘postbypost’ type mode, here’s an abbreviation of code I use in my archives summary page:

    <?php $arc_query = new WP_Query('orderby=post_date&order=DESC&showposts=20'); ?>
    <?php while ($arc_query->have_posts()) : $arc_query->the_post(); ?>
    <p><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a><br/>
    <?php the_excerpt(); ?></p>
    <?php endwhile; ?>

    Modify showposts to the number of posts you wish to display. Also, you may want to look at adding a &cat=# argument, where # is the category to restrict the posts to.

    Morning Kafkaesqui

    Yes – this is exactly what I meant and I thank you. I can play with this and start to get dirty with PHP at the same time – something I’ve been putting off! This is a perfect start.

    There is another place where I was hoping to use something like this to show recent posts in the same category as the one displayed (as on single.php template for example) but I am having trouble determining the Cat ID. I think the old deprecated tag the_category_id is what I need but that has gone. Any suggestions for retrieving the cat id of the current post would be welcomed and then I think I am done!

    Thanks once again – great help.

    Sorry left out some info. I only use a single cat ID for each post although these may be child cats. I don’t need an array of ID’s just the one. Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding Excerpt to Post Lists’ is closed to new replies.