Advertisement
deepbevel

posts with same tag of last post of current user

Jan 31st, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2. //display posts authored by the logged in user
  3. if ( is_user_logged_in() ) {
  4. global $current_user;
  5. get_currentuserinfo();
  6.  
  7. $args=array(
  8. 'author' => $current_user->ID,
  9. 'post_type' => 'post',
  10. 'post_status' => 'publish, private'
  11. );
  12.  
  13. global $post;
  14. query_posts ('cat=1 &posts_per_page=1'); ?>
  15. <div class="post" id="post-<?php the_ID(); ?>">
  16.  
  17. <?php
  18. //for use in the loop, list post titles related to first tag on current post
  19. $tags = wp_get_post_tags($post->ID);
  20. if ($tags) {
  21. echo '';
  22. $first_tag = $tags[0]->term_id;
  23. $args=array(
  24. 'tag__in' => array($first_tag),
  25. 'showposts'=>-1,
  26. 'caller_get_posts'=>1
  27. );
  28. $my_query = new WP_Query();
  29.  
  30. if( $my_query->have_posts() )
  31. {
  32. while ($my_query->have_posts()) : $my_query->the_post(); ?>
  33.  
  34. <ul>
  35.  
  36. <a href="<?php the_permalink(); ?>">
  37.  
  38. <?php the_title();?></a>
  39. </ul>
  40.  
  41. <?php endwhile;}}}?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement