$query = new WP_Query( array( 'category__and' => array(2,6) ) );
<?php
if($newCat == ""){
$cathotela = "88";
} else{
$cathotela = $newCat;
}
?>
<?php $posts = get_posts ("category=".$cathotela."&orderby=date&numberposts=3"); ?>
<?php if ($posts) : ?>
<?php foreach ($posts as $post) : setup_postdata ($post); ?>
<div class="image_sp col-sm-3 col-xs-12 imsp_el1">
<a href="<?php echo get_permalink(); ?> ">
<?php the_post_thumbnail() ?></a>
<div class="hdsp_text">
<h3><?php the_title(); ?></h3>
</div>
</div>
<?php
endforeach;
wp_reset_postdata();
?>
<?php endif; ?>
<?php
if($newCat == ""){
$cathotela = "88";
} else{
$cathotela = $newCat;
}
?>
<?php $posts = get_posts(array(
'category' => $cathotela,
'orderby' => 'date',
'numberposts' => 3,
'category__in' => array(2,3,4)
)); ?>
<?php if ($posts) : ?>
<?php foreach ($posts as $post) : setup_postdata ($post); ?>
<div class="image_sp col-sm-3 col-xs-12 imsp_el1">
<a href="<?php echo get_permalink(); ?> ">
<?php the_post_thumbnail() ?></a>
<div class="hdsp_text">
<h3><?php the_title(); ?></h3>
</div>
</div>
<?php
endforeach;
wp_reset_postdata();
?>
<?php endif; ?>
$args = array(
'orderby' => 'date',
'numberposts' => 3,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => $cathotela, //array( '53', '115', '27' )
'operator' => 'IN'
),
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => '88'
)
)
);
$posts = get_posts($args);