Advertisement
Guest User

all tags in category

a guest
Jun 25th, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2. global $post;
  3. query_posts ('cat=1 &posts_per_page=10'); ?>
  4. <?php if ( have_posts() ) : ?>
  5. <?php while (have_posts()) : the_post(); ?>
  6.  
  7. <h4>
  8. <?php
  9. the_tags( __( ' ',
  10. ' ' ), ', ', ''); ?> </p><?php
  11. $posttags = get_the_tags($post->ID);?>
  12. </h4>
  13.  
  14. <ul>
  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. <?php
  28. $my_query = new WP_Query($args);
  29.  
  30. if( $my_query->have_posts() ) {
  31. while ($my_query->have_posts()) : $my_query->the_post(); ?>
  32. <p style="padding: 1px; margin: 0;">
  33. <a>">
  34. <?php the_title(); ?> </a></p>
  35. <?php endwhile;}}?>
  36.  
  37. <!-- /html code -->
  38. <?php endwhile; ?>
  39. <?php else : ?>
  40. <!-- html code if nothing found -->
  41. <?php endif; ?>
  42. <?php wp_reset_query();?>
  43.  
  44. </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement