Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function related_portfolios() {
- global $post, $tw_options, $portAtts;
- $tags = wp_get_post_terms($post->ID, 'cat_portfolio', array("fields" => "ids"));
- if ($tags) {
- $notin = $post->ID;
- $rel_title = tw_option('translate_relatedportfolio') ? tw_option('translate_relatedportfolio') : __('Related portfolio items', 'themewaves');
- echo do_shortcode('[tw_item_title title="' . $rel_title . '"]');
- $tag_ids = array();
- foreach ($tags as $tag)
- $tag_ids[] = $tag;
- $query = Array(
- 'post_type' => 'tw_portfolio',
- 'posts_per_page' => '4',
- 'post__not_in' => array($notin),
- 'tax_query' => Array(Array(
- 'taxonomy' => 'cat_portfolio',
- 'terms' => $tag_ids,
- 'field' => 'id'
- ))
- );
- query_posts($query);
- $tw_options['pagination'] = 'none';
- $portAtts['hide_favorites'] = tw_option('hide_favorites')?'true':'false';
- echo '<div class="row"><div class="span12 related_portfolios"><div class="tw-portfolio">';
- get_template_part("loop", "portfolio");
- echo '</div></div></div>';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement