WordPress.org

Support

Support » How-To and Troubleshooting » Show List of Recent Posts Issues …

Show List of Recent Posts Issues …

  • 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

  • The topic ‘Show List of Recent Posts Issues …’ is closed to new replies.
Skip to toolbar