WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Show X numbers of posts in a X category (2 posts)

  1. ddcassy
    Member
    Posted 6 years ago #

    Hi, I've found this code:

    <ul>
            <?php $ultimos_post = get_posts('numberposts=5&category=1'); foreach($ultimos_post as $post) :?>
    
    <li><a>"><?php the_title(); ?></a></li>
            <?php endforeach; ?>
    
    </ul>

    This code shows the 5 last posts in the category 1.
    I've expend many hours trying to found this code, and finaly I Found it, I couldn't found it in this forum or in the wordpress codex, so I publish the solution for this problem.

  2. sp360
    Member
    Posted 6 years ago #

    what file is it in?

Topic Closed

This topic has been closed to new replies.

About this Topic