Advertisement
deepbevel

Untitled

Feb 7th, 2012
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1.  
  2. <?php
  3. global $post;
  4. query_posts ('cat=4 &posts_per_page=1'); ?>
  5. <?php if ( have_posts() ) : ?>
  6. <?php while (have_posts()) : the_post(); ?>
  7.  
  8. <h4>
  9. <?php
  10. the_tags( __( ' ',
  11. ' ' ), ', ', '<br />'); ?> </p><?php
  12. $posttags = get_the_tags($post->ID);?>
  13. </h4>
  14.  
  15. <?php
  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. 'showposts'=>-0,
  23. 'caller_get_posts'=>1,
  24. 'order' => 'ASC'
  25. );
  26.  
  27.  
  28. $my_query = new WP_Query($args);
  29.  
  30. if( $my_query->have_posts() )
  31.  
  32. {
  33.  
  34. while ($my_query->have_posts()) : $my_query->the_post(); ?>
  35.  
  36. <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"> <?php the_title(); ?> </a></p>
  37. <?php endwhile;}}?>
  38.  
  39. <!-- /html code -->
  40. <?php endwhile; ?>
  41. <?php else : ?>
  42. <!-- html code if nothing found -->
  43. <?php endif; ?>
  44. <?php wp_reset_query();?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement