Wordpress, show posts for Tags


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



Copy this code and paste it in your HTML
  1. /**
  2. * Show latest post for Tags
  3. *
  4. * @return
  5. * @param object $tag
  6. * @param object $show[optional]
  7. */
  8. function show_title_tag( $tag, $show=5 ) {
  9. global $post;
  10.  
  11. $posts = query_posts('tag=' . $tag . '&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.