Advertisement
alchymyth

list

Aug 14th, 2011
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. <em><h3 class="postmetadata"><span class="tags">
  2.  
  3. <?php the_tags( __( ' ', 'twentyten' ), ', ', ''); ?></h3></em>
  4.  
  5. <div class="entry">
  6.  
  7.     <div id="list-posts">
  8.     <?php
  9.     global $post;
  10.     query_posts ('cat=1 &posts_per_page=1'); ?>
  11.  
  12. <div class="post" id="post-<?php the_ID(); ?>">
  13.  
  14. <?php
  15. //for use in the loop, list 5 post titles related to first tag on current post
  16. $tags = wp_get_post_tags($post->ID);
  17. if ($tags) {
  18.   echo '';
  19.   $first_tag = $tags[0]->term_id;
  20.   $args=array(
  21.     'tag__in' => array($first_tag),
  22.  
  23.   'showposts'=>20,
  24.     'caller_get_posts'=>1
  25.    );
  26.   $my_query = new WP_Query($args);
  27.  
  28.   if( $my_query->have_posts() )
  29.  
  30.  { ?>
  31. <ul style="list-style-type: square; padding-left:10px; margin-left: 10px;">
  32. <?php
  33.     while ($my_query->have_posts()) : $my_query->the_post(); ?>
  34.  
  35.  
  36. <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"> <?php the_title(); ?> </a></li>
  37.  
  38. <?php endwhile; ?>
  39. </ul>
  40. <?php }}?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement