Advertisement
Guest User

Untitled

a guest
Nov 11th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. function related_portfolios() {
  2. global $post, $tw_options, $portAtts;
  3.  
  4. $tags = wp_get_post_terms($post->ID, 'cat_portfolio', array("fields" => "ids"));
  5.  
  6. if ($tags) {
  7. $notin = $post->ID;
  8. $rel_title = tw_option('translate_relatedportfolio') ? tw_option('translate_relatedportfolio') : __('Related portfolio items', 'themewaves');
  9. echo do_shortcode('[tw_item_title title="' . $rel_title . '"]');
  10. $tag_ids = array();
  11. foreach ($tags as $tag)
  12. $tag_ids[] = $tag;
  13. $query = Array(
  14. 'post_type' => 'tw_portfolio',
  15. 'posts_per_page' => '4',
  16. 'post__not_in' => array($notin),
  17. 'tax_query' => Array(Array(
  18. 'taxonomy' => 'cat_portfolio',
  19. 'terms' => $tag_ids,
  20. 'field' => 'id'
  21. ))
  22. );
  23. query_posts($query);
  24. $tw_options['pagination'] = 'none';
  25. $portAtts['hide_favorites'] = tw_option('hide_favorites')?'true':'false';
  26. echo '<div class="row"><div class="span12 related_portfolios"><div class="tw-portfolio">';
  27. get_template_part("loop", "portfolio");
  28. echo '</div></div></div>';
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement