File: //home/rassvet-tk.ru/public_html/wp-content/themes/rassvettk/page-single-post.php
<?php
/*
Template Name: Страница нужна
*/
?>
<?
$category_arr = array();
$our_cat = $_POST['cat_id'];
$offset = $_POST['offset'];
$categories1 = get_categories( array(
'type' => 'post',
'child_of' => 5,
'parent' => '',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'exclude' => '',
'include' => '',
'number' => 0,
'taxonomy' => 'category',
'pad_counts' => false,
) );
foreach((get_the_category($id)) as $category) {
$current_cat = $category->cat_ID;
array_unshift($category_arr, $current_cat);
}
$args = array('numberposts' => 9,'offset' => $offset, 'category' => $our_cat, );
$recent_posts_array = get_posts($args);
foreach( $recent_posts_array as $post ) :
setup_postdata($post);
$postid = $post -> ID;
$podcat = get_field('podkategorija_tovara');
?>
<?if($postid != $currentID):?>
<div class="col-md-6 col-sm-6 col-xs-12 catalog_list_tovar" style="margin-top:20px;" >
<a href="<?echo(get_permalink( $recent_post_single ))?>">
<div class="tovar_div_img" style="background:url('<?echo (get_the_post_thumbnail_url($postid,'middle')) ?>') no-repeat; background-size:cover; background-position: center;">
</div>
<? the_title(); ?>
</a>
</div>
<?endif;?>
<?endforeach;?>