Support » Themes and Templates » Show post from a specific category

  • Either I’m an idiot or haven’t located exactly what I am looking for. I believe my issue is pretty simply, but I’m having no luck:

    I would like to display the 3 most recent post from my Blog category (cat=1)within the template for my homepage (home.php).

    How do I do this? And thanks in advance to anyone willing to help.

Viewing 1 replies (of 1 total)
  • <?php
    //display 3 post from category 109
       'category__in' => array(109),
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <p><small><?php the_time('m.d.y') ?></small> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
    the_content(); //use the_excerpt() for a summary
    //this is necessary to show the tags
    global $wp_query;
    $wp_query->in_the_loop = true;
Viewing 1 replies (of 1 total)
  • The topic ‘Show post from a specific category’ is closed to new replies.