Support » Themes and Templates » Last 3 post on front page from one category?

  • Resolved Originalas

    (@originalas)


    Can somebody explain how to put for example: 3 latest post from category “featured” to front page? Maybe not the whole post, but only the description (Excerpt).

Viewing 3 replies - 1 through 3 (of 3 total)
  • educationthemes

    (@educationthemes)

    <?php $recent = new WP_Query("cat=3&showposts=3"); while($recent->have_posts()) : $recent->the_post();?>
    <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    <?php the_excerpt(); ?>
    <?php endwhile; ?>

    Change cat=3 to the category ID you want to display 3 posts from.

    Originalas

    (@originalas)

    Cool! it works! 🙂 Thanks

    But, if i want display last post of two categories, what put in cat=”…” ???
    Thanks!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Last 3 post on front page from one category?’ is closed to new replies.