<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => 48,
)
)
);
$all_magazines = array();
$products = new WP_Query( $args );
if ( $products->have_posts() ) :
while ( $products->have_posts() ) : $products->the_post();
$year = get_field('magazine_year');
$all_magazines[$year][] = $post;
endwhile;
endif;
wp_reset_postdata();
foreach ($all_magazines as $year => $magazines) { ?>
<p><?php echo $year;?> рік</p>
<ul>
<?php foreach ($magazines as $magazine) {?>
<li><a href="<?php the_permalink($magazine->ID)?>"><?php echo $magazine->post_title;?></a></li>
<?php } ?>
</ul>
<?php }
?>
@media only screen and (max-width: 1000px)
.category_table tr {
display: block;
}
@media only screen and (max-width: 1000px)
.category_table td {
display: block;
}
if( $my_query->have_posts() ) {
$i=1;
echo '<div class="grid">';
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<div class="grid-item<?php if($i==3) echo '-h2';?>">
<div class="overwrap-images">
<a href="<?php the_permalink();?>"><?php the_post_thumbnail();?></a>
<div class="overwrap-date">
<a href="<?php the_permalink();?>" class="date"><?php the_date('d/m/Y');?></a>
<h3><a href="<?php the_permalink();?>"><?php the_title();?></a></h3>
<p class="desc">
<?php the_excerpt();?>
</p>
</div>
</div>
</div>
<?php $i++;
}
echo '</div>';
}