wp_back/wp-content/themes/simple-theme/template-blog.php
2024-05-20 15:37:46 +03:00

105 lines
3.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
//Template Name: Blog
get_header();
if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb( '<p id="breadcrumbs" class="breadcrumbs-container"><span><a href="#">Pampadu</a></span> <span class="breadcrump-separator">&mdash;</span> ','</p>' );
}
?>
<div class="layout ppd-container align-start column_mobile">
<div class="layout blog-tags wrap">
<a class="tag-item all_tag" href="<?=str_replace("\"", "", "http://pamtest.ru");?>/">
<div id="all" class="blog-tag <?php if(!is_tag()):?>active<?php endif;?>">Все</div>
</a>
<?php
$value = get_field( "tag_list" );
if (!empty($value)) : ?>
<?php foreach ($value as $term) : ?>
<a class="tag-item <?= $term->slug . '__tag'?> <?php if(is_tag($term->slug)):?>tag-item__active<?php endif;?>" tabindex="0" href="<?=str_replace("\"", "", "http://pamtest.ru");?>/tag/<?= $term->slug ?>/">
<div id="<?= $term->slug ?>" class="blog-tag <?php if(is_tag($term->slug)):?>active<?php endif;?>"><?= $term->name ?></div>
</a>
<?php endforeach; ?>
<?php endif;
?>
<button class="tag-item show-all_tag">
<span>Ещё</span>
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6" fill="none">
<path d="M5 4.18934L8.78064 0.21967C9.05958 -0.0732236 9.51184 -0.0732236 9.79079 0.21967C10.0697 0.512563 10.0697 0.987437 9.79079 1.28033L5.50508 5.78033C5.22613 6.07322 4.77387 6.07322 4.49492 5.78033L0.209209 1.28033C-0.0697365 0.987437 -0.0697365 0.512563 0.209209 0.21967C0.488155 -0.0732236 0.940416 -0.0732236 1.21936 0.21967L5 4.18934Z" fill="#7D8D93"/>
</svg>
</button>
</div>
</div>
<div class="layout ppd-container column">
<div class="layout article-cards wrap" id="articles-container" data-paged="<?php echo $PAGEN; ?>" data-title="Блог Пампаду — рассказываем о нас и о том, как зарабатывать на страховании" data-total="">
<?php
$current = !empty( $_GET['PAGEN'] ) ? $_GET['PAGEN'] : 1;
$query = new WP_Query(
[
'post_type' => 'post',
'posts_per_page' => 13,
'paged' => $current,
// 'tag' => 'izmenenie-kv'
]
);
$myposts = get_posts( array(
'posts_per_page' => 13,
'paged' => $current,
// 'tag' => 'izmenenie-kv'
) );
$posts_counter = 0;
foreach( $myposts as $post ){
setup_postdata( $post );
if($posts_counter==3){
echo get_template_part('blog-posts/blog-post-small');
echo get_template_part('blog-posts/blog-banner');
}
else if($posts_counter==8){
echo '</div>';
echo '</div>';
echo get_template_part('blog-posts/tag-banner-banki');
echo '<div class="layout ppd-container column column-after-adv">';
echo '<div class="layout article-cards wrap">';
}
else{
echo get_template_part('blog-posts/blog-post-small');
}
// echo '<br>';
$posts_counter++;
// echo $posts_counter;
}
wp_reset_postdata();
// $paginate_args = [
// 'total' => $query->max_num_pages,
// 'current' => $current,
// 'format' => '?PAGEN=%#%',
// 'base' => site_url() . '%_%',
// 'prev_next' => 'false',
// ];
echo '<div class="pagination-container">';
// var_dump (paginate_links($paginate_args));
echo wp_kses_post(
paginate_links(
[
'prev_next' => 'false',
'total' => $query->max_num_pages,
'current' => $current,
'format' => '?PAGEN=%#%',
'base' => site_url() . '%_%',
]
)
);
?>
</div>
</div>
</div>
<?php get_footer(); ?>