display last post/posts in custom category in WordPress
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 2.00 out of 5)
Loading ... Loading ...

<ul>
      <?php $recentposts = get_posts('numberposts=3&category=5'); foreach ($recentposts as $post) : setup_postdata($post); ?>
      <li>
        <a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a>
        <span><strong> <?php the_time('d.m.Y'); ?> </strong> in <strong> <?php the_category(' '); ?></strong></span>
      </li>
      <?php endforeach; ?>
    </ul>

You may want to check :

  1. display recent posts
  2. Going Even Further With Custom Taxonomies AND Post Types
  3. Display the most popular posts, based on number of comments
  4. Display similar / Related Posts Without A Plug-In
  5. most commented / popular posts based on comments count

Post a Comment

Your email is never shared. Required fields are marked *

*
*