Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using the Modest theme from elegant themes at http://lilsaintz.co.nz

Under the slider on the homepage, there are three content areas that are generated from pages.

I would like to make one of the content areas a "Latest News" element showing the last 5 posts from the blog (category = blog).

Bearing in mind that I am a complete WP novice - although I am really good at following instructions :) - what would be the best way to go about doing this?

Thank you!

share|improve this question
    
add comment

1 Answer 1

Probably the get_posts tag. It's simple, you just need a loop.

<?php
   $args = array( 'numberposts' => 5, 'cat' => 5 );
   $postslist = get_posts( $args );
   foreach ($postslist as $post) :  setup_postdata($post); ?> 
   <div>
    <?php the_date(); ?>
    <br />
    <?php the_title(); ?>   
    <?php the_excerpt(); ?>
   </div>
<?php endforeach; ?>

That will show the last 5 posts from the category with ID 5. Complete parameters list.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.