PHP – WordPress – Get only Titles from Specific Category

The given PHP example helps you to take the titles from a certain category and lists them in an 
unordered list. 

Code Example:
$cat_posts = get_posts('category=5&numberposts=-1'); # -1 for all posts
foreach($cat_posts as $post) : setup_postdata($post);
<li><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permalink to <?php the_title(); ?>">
<?php the_title(); ?>
<?php endforeach; ?>

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail

Leave a Comment

Your email address will not be published. Required fields are marked *