Limit recent posts on home page to one per category

I am able to display recent posts on my static home page. However, I need to split this out to show only 1 recent post per category, there are 4 categories.

Here is my current code – the pagination doesn’t work either though:

Read More
<?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query('showposts=4' . '&paged='.$paged);
    while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <?php the_post_thumbnail(); ?>
    <h2><a href="<?php the_permalink(); ?>" title="Read more"><?php the_title(); ?></a></h2>
    <?php the_excerpt(); ?>
    <?php endwhile; ?>
    //this doesn't work, it displays previous page but doesn't change the items listed when clicked
    <?php if ($paged > 1) { ?>
        <nav id="nav-posts">
           <div class="prev"><?php next_posts_link('&laquo; Previous Posts'); ?></div>
           <div class="next"><?php previous_posts_link('Newer Posts &raquo;'); ?></div>
        </nav>

<?php } else { ?>

    <nav id="nav-posts">
    <div class="prev"><?php next_posts_link('&laquo; Previous Posts'); ?></div>
    </nav>                                              

<?php } ?>

<?php wp_reset_postdata(); ?>

I know there are plugins out there, but I would benefit more from learning the code than using a plug in. I appreciate any advice.

Related posts