WordPress
3
Вклад в тег
<!-- Карточки -->
<div class="row catalogue_main__cards">
<?php $penis = get_the_ID(); ?>
<?php
$sort = $_COOKIE["catalog_sort"];
$show_count = (int)$_COOKIE["catalog_show_count"];
$sort = str_replace('\\', "", $sort);
$sort = json_decode($sort, true);
if(!$show_count)
$show_count = 24;
$queryArr = array(
'post_type' => 'page',
'post_parent' => $penis,
'meta_query' => array(
"template" => array(
"key" => "_wp_page_template",
"value" => "templates/catalogue_detail.php",
"type" => 'NUMERIC'
),
),
'paged' => $currPage,
'posts_per_page' => $show_count,
'order' => strtoupper($sort["type"]),
);
if($sort)
{
switch ($sort["by"]) {
case 'alphabet':
$queryArr["orderby"] = "title";
break;
case 'price':
$queryArr["meta_key"] = "item_price";
$queryArr["orderby"] = "meta_value_num";
break;
}
}
$query = new WP_Query( $queryArr );
while ($query->have_posts()) : $query->the_post();?>
<?php $aidi = get_the_ID(); ?>
<!-- Вывод -->
<div class="col-lg-4 col-md-4 col-6">
<a href="<?php the_permalink(); ?>" class="events_items_slider__block" tabindex="0">
<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'full-size', true);
?>
<div class="event_card__pic contain" style="background-image: url(<?php echo $thumb_url[0];?>);"></div>
<p class="events_items_slider__block__title"><?php the_title();?></p>
<p class="events_items_slider__block__price"><?php the_field('item_price'); ?> ₽</p>
</a>
</div>
<!-- Конец цикла -->
<?php
endwhile;
wp_reset_query();
?>