Support » Plugins and Hacks » Last 5 posts in Category

  • hi, I would like to display lasts 5 posts from a category on the post page. I searched the forum but many lead to closed plugin pages. Could you help me?

    I am using Wp2

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin: Customizable Post Listings

    and guess what? Just searching in wp forum with your post title gave me an answer.

    I installed it but I couldnt get it work for different categories in different post pages


    <?php c2c_get_recent_posts(10, “%post_URL%
    “, “$cat”, “date”, “DESC”, 0); ?>

    I solved this problem by introducing an if in the loop.
    The code should be something like this:

    			$cont = 0;
    			while (have_posts()) : the_post(); ?>
                <?php if($cont < 5){ ?>
    			<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                <?php the_content(); ?>
                <p class="postmetadata">Posted in <small><?php the_time('d \d\e F \d\e Y'); ?></small> under: <?php the_category(', '); ?>
                <?php $cont++; }?>
    			<?php endwhile;?>

    to me it works just fine.
    Any comments?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Last 5 posts in Category’ is closed to new replies.