<div class="swiper-container">
<div class="swiper-wrapper">
<?php
$query = new WP_Query( array( 'cat' => 5, 'showposts' => 100 ) );
while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="service__slide" id="bx_651765591_37">
<?php $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); ?>
<a href="" class="card-service card-service--family" style="background-image:url(<?php echo $image_url[0]; ?>);">
<div class="card-service__title"><?php the_title(); ?></div>
<span class="card-service__link"><?php the_content(); ?></span>
</a>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div>
</div>
function shownews(){
ob_start();
?>
<div class="swiper-container">
<div class="swiper-wrapper">
<?php
$query = new WP_Query( array( 'cat' => 5, 'showposts' => 100 ) );
while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="service__slide" id="bx_651765591_37">
<?php $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); ?>
<a href="" class="card-service card-service--family" style="background-image:url(<?php echo $image_url[0]; ?>);">
<div class="card-service__title"><?php the_title(); ?></div>
<span class="card-service__link"><?php the_content(); ?></span>
</a>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div>
</div>
<?php
return ob_get_clean();
}
add_shortcode('shortshownews', 'shownews');