Posted By

gfazioli on 06/04/09


Tagged

post wordpress category querypost


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

mrbassman12
lilumi
maxvee8


Wordpress, show posts for category


 / Published in: PHP
 

URL: http://www.undolog.com

  1. /**
  2. * Show latest posts for category
  3. *
  4. * @return
  5. * @param object $cats
  6. * @param object $show[optional]
  7. */
  8. function show_title_cat( $cats, $show=5 ) {
  9. global $post;
  10.  
  11. $posts = query_posts('cat=' . $cats . '&showposts=' . $show );
  12. echo "<ul>";
  13. foreach ($posts as $post ) : setup_postdata($post); ?>
  14. <li><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></li>
  15. <?php endforeach;
  16. echo "</ul>";
  17. }

Report this snippet  

You need to login to post a comment.