WordPress.org

Ready to get started?Download WordPress

Forums

Show Recent Posts/Title Only/One Category (1 post)

  1. Roar
    Member
    Posted 5 years ago #

    Hi everyone,

    I would like to show on the homepage sidebar a listing of recent posts titles from only one category.

    I found this post:
    http://wordpress.org/support/topic/156721?replies=7

    and tried this code (i tried it on a page to test it)
    4 is my category number

    <ul>
    <?php query_posts('category_id=4&showposts=3');?>
    <?php $posts = get_posts('category=4&numberposts=3&offset=0');
    	foreach ($posts as $post) : start_wp(); ?>
    <li><a href="<?php echo get_permalink() ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?></ul>

    and this is what it returns?
    http://www.tokiohotelamerica.com/yrdy/

    3 links back to the same page.

    Help?

Topic Closed

This topic has been closed to new replies.

About this Topic