On my homepage I have a slider at the top and then three columns below that. I would like to pull the three latest post for a category in each column. So each column will have three post titles and dates for a single category.

Can anyone tell me what the Query would be?

Thanks in advance,


1 Answer 1


Try this:

global $post;
$args = array( 'numberposts' => 5, 'category' => 1 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :  setup_postdata($post); ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> - <?php the_date(); ?></li>
<?php endforeach; ?>

More info: query_posts()

  • Thanks for the reply. I was wondering if there is a way to use category "name" not id number because for some reason my events category doesn't work. I was also wonder if there was a way to list these post titles without bullets. Thanks, 14ner
    – user3992
    Mar 16, 2011 at 18:24
  • @14ner category name can be easily converted to IF with get_cat_ID() function.
    – Rarst
    Mar 16, 2011 at 20:46
  • To remove bullets, see the "Applying the CSS" section of this page of the WordPress documentation: codex.wordpress.org/Creating_Horizontal_Menus
    – GavinR
    Mar 25, 2011 at 13:17

Your Answer

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