<?php get_header(); ?>
<div class="page-content page-news-single">
<div class="container">
<div class="cont-two flex_block">
<div class="cont-left">
<div class="content-title"><h1><?php the_title(); ?></h1></div>
<div class="breadgrumbs">
<ul>
<li><a href="/">Главная</a></li>
<li><a href="/vazhnye-stati-uk-rf/">Информация</a></li>
</ul>
</div>
<div class="entrytext">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
</div>
</div>
<div class="cont-right">
<div class="title-block">Возможно, вам <br>будет интересно</div>
<?php
if (is_singular('laws')) {
$current_product_id = get_the_ID();
$product_categories = wp_get_post_terms($current_product_id, 'lawscat', array('fields' => 'ids'));
$args = array(
'post_type' => 'laws',
'posts_per_page' => 10,
'post__not_in' => array($current_product_id),
'tax_query' => array(
array(
'taxonomy' => 'lawscat',
'field' => 'id',
'terms' => $product_categories
)
)
);
$related_products_query = new WP_Query($args);
if ($related_products_query->have_posts()) {
?>
<?php
while ($related_products_query->have_posts()) {
$related_products_query->the_post(); ?>
<a class="laws-item" href="<?php the_permalink(); ?>">
<span class="icon">
<span style="background-image: url(<?php the_field('иконка'); ?>)"></span>
</span>
<div class="text"><p><?php the_title(); ?></p></div>
</a>
<?php } ?>
<?php } wp_reset_postdata(); } ?>
</div>
</div>
</div>
</div>
<?php get_footer() ?>