/ Published in: PHP
Useful snippet for getting a specific number of posts from a specific category, useful for news listing in sidebar
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<ul> <?php global $post; $myposts = get_posts('numberposts=6&category=3'); foreach($myposts as $post) : setup_postdata($post); ?> <li> <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> </div> </li> <?php endforeach; ?> </ul>