shkola/wp-content/themes/dekart/template-parts/pksh/external-reviews.php
2026-07-18 16:05:15 +00:00

69 lines
2.1 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
/**
* Отзывы на внешних площадках.
* Карточки выводятся только если ссылка на площадку заполнена в настройках.
* Если ни одна ссылка не заполнена — секция не выводится.
*
* @package Dekart
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$data = Pksh_Data::instance();
$city_prep = $data->get_city_prep();
$platforms = array(
'yandex' => array(
'url' => get_option( 'branch_ext_yandex', '' ),
'icon' => 'Я',
'name' => 'Яндекс.Карты',
'rating' => '4.8',
),
'2gis' => array(
'url' => get_option( 'branch_ext_2gis', '' ),
'icon' => '2ГИС',
'name' => '2ГИС',
'rating' => '4.7',
),
'vk' => array(
'url' => get_option( 'branch_ext_vk', '' ),
'icon' => 'ВК',
'name' => 'ВКонтакте',
'rating' => '4.9',
),
'otzovik' => array(
'url' => get_option( 'branch_ext_otzovik', '' ),
'icon' => 'O',
'name' => 'Otzovik',
'rating' => '4.6',
),
);
// Фильтруем: только площадки с заполненной ссылкой
$active = array_filter( $platforms, function( $p ) {
return ! empty( $p['url'] );
} );
if ( empty( $active ) ) {
return;
}
?>
<section class="bento pksh-section" aria-label="Отзывы на внешних площадках">
<div class="bento__full section-header--left">
<div class="external-reviews">
<h2 class="bento-h2">Нас рекомендуют на площадках — отзывы о подготовке к школе <?php echo esc_html( $city_prep ); ?></h2>
<div class="external-reviews__grid">
<?php foreach ( $active as $p ) : ?>
<a href="<?php echo esc_url( $p['url'] ); ?>" target="_blank" rel="noopener noreferrer" class="external-reviews__card">
<span class="external-reviews__icon"><?php echo esc_html( $p['icon'] ); ?></span>
<span class="external-reviews__name"><?php echo esc_html( $p['name'] ); ?></span>
<span class="external-reviews__rating">⭐ <?php echo esc_html( $p['rating'] ); ?></span>
</a>
<?php endforeach; ?>
</div>
</div>
</div>
</section>