WordPress.org

Ready to get started?Download WordPress

Forums

Show List of Recent Posts Issues ... (1 post)

  1. thornomad
    Member
    Posted 5 years ago #

    Hi,

    I am using the following code to display a list of links to recent posts from my "blog" category (cat=1):

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

    This works great (got it from the codex); however, when I am in my "events" category (cat #2) it stops working ... the code works on all other pages and in cat #1 ... however, when I view cat #2 it disappears. Any way around this?

    Thanks,
    Damon

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.