0

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!

1

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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