<div class="portfolio-container-tags">
<div class="portfolio-wrapper row container">
<?php
$tags = get_the_tags();
if(is_singular( 'portfolio' ) ) {
$tag = array_pop($tags);
$numberPost = 1000;
}
else {
$numberPost = 6;
}
$lastposts = get_posts( array(
'numberposts' => $numberPost,
'tag' => $tag->slug,
'category' => 0,
'orderby' => 'menu_order',
'order' => 'DESC',
'include' => array(),
'exclude' => array(),
'meta_key' => '',
'meta_value' =>'',
'post_type' => 'portfolio',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
) );
foreach( $lastposts as $post ){ setup_postdata($post);
?>
<div class="portfolio-item">
<div class="portfolio-images">
<a class="fancybox" rel="group" href="<?php the_post_thumbnail_url('large')?>">
<img src="<?php the_post_thumbnail_url()?>" alt="Фотография">
</a>
</div>
<h2>
<? the_title() ?>
</h2>
<?the_content()?>
</div>
<?php
}
wp_reset_postdata();
?>
</div>
<?
if(!is_singular('services')) {
$tags = get_tags();
$html = '<div class="post_tags">';
foreach ( $tags as $tag ) {
$tag_link = get_tag_link( $tag->term_id );
$html .= "<a href='{$tag_link}' title='{$tag->name}' class='tags-name {$tag->slug}'>";
$html .= "{$tag->name}</a>";
}
$html .= '</div>';
echo $html;
}
?>
</div>
</div>