Support » Plugins » Widget that provides recent posts from a category?

  • How hard would it be to write a widget that provided the 5 latest posts from a particular category? Does anyone know of a widget like this that’s already out there?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Look at one of the latest posts widget and replace the line containing the template call for the latest posts with one calling the latest posts for the specific category.

    You’d have to rename the functions as well so they don’t be duped.

    Shouldn’t be too hard.

    Well, I already answered this in another post, but here it is again:

    <ul>
     <?php
     global $post;
     $myposts = get_posts('numberposts=5&offset=1&category=1');
     foreach($myposts as $post) :
     setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
     </ul>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Widget that provides recent posts from a category?’ is closed to new replies.