Skip to content

Instantly share code, notes, and snippets.

@BJIAST
Created September 6, 2018 09:49
Show Gist options
  • Save BJIAST/d7526e98fe26a605a26c2435e5ed1b5b to your computer and use it in GitHub Desktop.
Save BJIAST/d7526e98fe26a605a26c2435e5ed1b5b to your computer and use it in GitHub Desktop.
<?php
$current_page = (get_query_var('paged')) ? get_query_var('paged') : 1;
$params = array(
'posts_per_page' => 6,
'post_type' => 'post',
'paged' => $current_page
);
query_posts($params);
if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="col-sm-12 col-md-4 mb-5 news-card-container" <?= $current_page ?>>
<div class="news-card text-center">
<div class="news-image">
<?php the_post_thumbnail(); ?>
</div>
<h3><?= get_the_title(); ?></h3>
<p> <?= get_excerpt(400) ?></p>
<div class="card-bottom">
<a href="<?php the_permalink(); ?>" class="news-btn">Подробнее</a>
</div>
</div>
</div>
<?php endwhile;
endif;
wp_reset_postdata();
$nav = get_the_posts_pagination();
$nav = preg_replace('~<h2.*?h2>~', '', $nav);
echo $nav;
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment