Return to Snippet

Revision: 50466
at August 23, 2011 22:16 by i-am-andy

Initial Code
    global $post;
    $myposts = get_posts('numberposts=6&category=3');
    foreach($myposts as $post) :
    <div class="news_ticker_articles">
      <p><strong> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
        <?php the_title(); ?>
        </a> </strong></p>
      <p class="excerpt_bottom"><? echo bm_better_excerpt(100, '...'); ?></p>
  <?php endforeach; ?>

Initial URL

Initial Description
Useful snippet for getting a specific number of posts from a specific category, useful for news listing in sidebar

Initial Title
Get Posts from Category

Initial Tags
php, wordpress

Initial Language