Advertisement
Guest User

Untitled

a guest
Apr 26th, 2012
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. <aside id="more_from" class="span2">
  2.  
  3. Some projects from <br />
  4. <?php
  5.  
  6. $service_types = $term_list = get_the_terms( $post->ID, 'service');
  7.  
  8. if(!is_wp_error( $service_types ) && $service_types) :
  9.  
  10. foreach($service_types as $service_type) :
  11. ?>
  12.  
  13. <span class="btn btn-info btn_white_text btn-mini"><?php echo $service_type->name; ?></span><br />
  14.  
  15. <!-- pull other items in the current section -->
  16.  
  17. <?php
  18. $t_args = array (
  19. 'orderby' => 'rand',
  20. 'post_type' => 'portfolio',
  21. 'posts_per_page' => 5,
  22. 'post__not_in' => array($post->ID),
  23. 'tax_query' => array(
  24. array(
  25. 'taxonomy' => 'service',
  26. 'field' => 'id',
  27. 'terms' => $service_type->term_id
  28. )
  29. )
  30. );
  31.  
  32. $query = new WP_Query( $t_args );
  33.  
  34. if( $query->have_posts() ) {
  35.  
  36. while ( $query->have_posts() ) : $query->the_post();
  37.  
  38. // output your stuff
  39. echo '<div class="more_from_thumb"><a href="';
  40. the_permalink();
  41. echo '">';
  42. //the_post_thumbnail('tiny_thumb');
  43. the_title();
  44. echo '</a></div>';
  45. endwhile;
  46. wp_reset_postdata();
  47. } ?>
  48. </aside> <!--#more_from-->
  49. <?php endforeach; ?>
  50. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement