Posted By

thewickedchemist on 05/28/12


Tagged

php wordpress loop


Versions (?)

WORDPRESS - Get only titles from specific category


 / Published in: PHP
 

Takes titles from a certain category and lists them in an unordered list.

  1. <ul>
  2. <?php
  3. $cat_posts = get_posts('category=10&numberposts=-1');
  4. foreach($cat_posts as $post) : setup_postdata($post);
  5. ?>
  6. <li><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permalink to <?php the_title(); ?>">
  7. <?php the_title(); ?>
  8. </a></li>
  9. <?php endforeach; ?>
  10. </ul>

Report this snippet  

You need to login to post a comment.