120 lines
5.8 KiB
PHP
120 lines
5.8 KiB
PHP
<?php
|
|
/*
|
|
Template Name: Шаблон страницы все курсы
|
|
*/
|
|
?>
|
|
<?php
|
|
get_header();
|
|
$post_id = get_the_ID();
|
|
?>
|
|
<?php $foto = carbon_get_post_meta( $post_id, 'banner_img_desktop' ); ?>
|
|
<?php $foto_mobile = carbon_get_post_meta( $post_id, 'banner_img_mobile' ); ?>
|
|
|
|
<main class="page page-courses">
|
|
<?php if ( $foto != '') { ?>
|
|
<nav class="banner container" aria-label="Хлебные крошки">
|
|
<ul class="breadcrumbs desktop" itemscope itemtype="https://schema.org/BreadcrumbList">
|
|
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
|
<a itemprop="item" href="<?php echo home_url(); ?>/" class="home fa-home" title="Главная страница">
|
|
<span itemprop="name" style='display:none;'>Главная</span>
|
|
<svg width="21" height="16" viewBox="0 0 21 16" fill="none">
|
|
<path d="M11.6473 10.6896H12.1473V11.1896V15.4691H16.4353C16.5143 15.4691 16.5756 15.4462 16.6432 15.3788C16.7108 15.3113 16.7333 15.2505 16.7333 15.1725V9.36976L10.0513 3.8712L3.36922 9.36976V15.1725C3.36922 15.2505 3.39178 15.3113 3.45937 15.3788C3.52698 15.4462 3.5883 15.4691 3.66723 15.4691H7.95527V11.1896V10.6896H8.45527H11.6473ZM10.3711 1.74407L18.9226 8.86174L19.5643 8.09722L16.9141 5.8987L16.7333 5.74874V5.51388V0.537319H14.5413V2.86272V3.93127L13.7209 3.2466L10.6815 0.709949C10.5114 0.572829 10.3095 0.499981 10.0513 0.499981C9.79293 0.499981 9.59094 0.572914 9.42075 0.710194L0.538196 8.09712L1.17996 8.86174L9.73142 1.74407L10.0513 1.47783L10.3711 1.74407Z" fill="white" stroke="white"/>
|
|
</svg>
|
|
</a>
|
|
<meta itemprop="position" content="1">
|
|
</li>
|
|
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
|
<span class='last_item' itemprop="name"><?php the_title()?></span>
|
|
<meta itemprop="position" content="2">
|
|
</li>
|
|
</ul>
|
|
<div class="banner-wrapper">
|
|
<?php $foto = carbon_get_post_meta( $post_id, 'banner_img_desktop' ); ?>
|
|
<?php $foto_mobile = carbon_get_post_meta( $post_id, 'banner_img_mobile' ); ?>
|
|
<picture class="banner-fon">
|
|
<source srcset="<?php echo wp_get_attachment_url($foto); ?>" media="(min-width: 780px)">
|
|
<img src="<?php echo wp_get_attachment_url($foto_mobile); ?>" alt="<?php echo get_post_meta( $foto, '_wp_attachment_image_alt', true ); ?>">
|
|
</picture>
|
|
</div>
|
|
</nav>
|
|
<?php } //else echo '<div class="banner_expander"></div>'; ?>
|
|
<section class="courses-section">
|
|
<div class="container">
|
|
<h1 class="teachers_title"><?php the_title()?></h1>
|
|
|
|
<div class="main_content">
|
|
<?php the_content(); ?>
|
|
</div>
|
|
|
|
<?php
|
|
$currentPage = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
|
|
|
|
$args = array(
|
|
'orderby' => 'date',
|
|
'order' => 'DESC',
|
|
'post_type' => 'course',
|
|
'posts_per_page' => 9,
|
|
'paged' => $currentPage,
|
|
);
|
|
$query = new WP_Query($args); ?>
|
|
<div class="courses-wrapper">
|
|
<?php
|
|
while ($query->have_posts()) {
|
|
|
|
$query->the_post();
|
|
$post_id = get_the_ID();?>
|
|
|
|
<a href="<?php the_permalink(); ?>" class="course__item">
|
|
<div class="popular__subject_img">
|
|
<?php $label = carbon_get_post_meta( $post_id, 'box_label' );
|
|
if ($label != "") :?>
|
|
<span class="popular__subject_label"><?php echo $label; ?></span>
|
|
<?php endif; ?>
|
|
<?php $gallery = get_field('gallery'); ?>
|
|
<?php if (!empty($gallery)) {?>
|
|
<img src="<?php echo $gallery[0]['url']; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>">
|
|
<?php } else {?>
|
|
<img src="/wp-content/uploads/2021/02/podgotovka-k-oge-po-geografii.jpg" alt="<?php the_title(); ?>" title="<?php the_title(); ?>">
|
|
<?php } ?>
|
|
</div>
|
|
<div class="product-info">
|
|
<h3 class="popular__subject_title"><?php the_title(); ?></h3>
|
|
<p class="popular__subject_text"><?php $informaciya_o_kurse = get_field('informaciya_o_kurse');
|
|
echo wp_trim_words( $informaciya_o_kurse, 300, ' ...' );
|
|
?></p>
|
|
</div>
|
|
</a>
|
|
<?php } wp_reset_postdata(); ?>
|
|
</div>
|
|
<div class="page-numbers-wrapper">
|
|
<?php
|
|
echo paginate_links([
|
|
"base" => str_replace(999999999, "%#%", get_pagenum_link(999999999)),
|
|
"format" => "",
|
|
"current" => max(1, $currentPage),
|
|
"total" => $query->max_num_pages,
|
|
"prev_text" => '<svg style="transform: scale(-1, -1);" width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<rect width="40" height="40" rx="5" fill="#D9D9D9"/>
|
|
<path d="M29.7071 20.7071C30.0976 20.3166 30.0976 19.6834 29.7071 19.2929L23.3431 12.9289C22.9526 12.5384 22.3195 12.5384 21.9289 12.9289C21.5384 13.3195 21.5384 13.9526 21.9289 14.3431L27.5858 20L21.9289 25.6569C21.5384 26.0474 21.5384 26.6805 21.9289 27.0711C22.3195 27.4616 22.9526 27.4616 23.3431 27.0711L29.7071 20.7071ZM12 21H29V19H12V21Z" fill="#1F1F1F"/>
|
|
</svg>', // анкор ссылки на предыдущую страницу
|
|
"next_text" => '<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<rect width="40" height="40" rx="5" fill="#D9D9D9"/>
|
|
<path d="M29.7071 20.7071C30.0976 20.3166 30.0976 19.6834 29.7071 19.2929L23.3431 12.9289C22.9526 12.5384 22.3195 12.5384 21.9289 12.9289C21.5384 13.3195 21.5384 13.9526 21.9289 14.3431L27.5858 20L21.9289 25.6569C21.5384 26.0474 21.5384 26.6805 21.9289 27.0711C22.3195 27.4616 22.9526 27.4616 23.3431 27.0711L29.7071 20.7071ZM12 21H29V19H12V21Z" fill="#1F1F1F"/>
|
|
</svg>', // анкор ссылки на следующую страницу
|
|
"type" => "list"
|
|
]);?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
|
|
<?php get_template_part( 'template-parts/promo-form' ); ?>
|
|
|
|
<?php get_template_part( 'template-parts/map' ); ?>
|
|
|
|
</main>
|
|
|
|
<?php
|
|
get_footer();
|
|
|