Wordpress, show posts for category


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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. }

URL: http://www.undolog.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.