113 lines
5.5 KiB
PHP
113 lines
5.5 KiB
PHP
<?php
|
||
/**
|
||
* Шаблон: Контакты + Яндекс.Карта
|
||
* Переиспользуемый — не зависит от Pksh_Data.
|
||
* Данные: get_option('branch_*') с fallback на carbon_get_theme_option('site_*')
|
||
*
|
||
* @package Dekart
|
||
*/
|
||
|
||
if ( ! defined( 'ABSPATH' ) ) {
|
||
exit;
|
||
}
|
||
|
||
$opt_phone = get_option( 'branch_phone' ) ?: carbon_get_theme_option( 'site_phone' ) ?: '';
|
||
$opt_email = get_option( 'branch_email' ) ?: carbon_get_theme_option( 'site_mail' ) ?: '';
|
||
$opt_address = get_option( 'branch_address' ) ?: carbon_get_theme_option( 'site_address' ) ?: '';
|
||
$opt_name = get_option( 'branch_name' ) ?: carbon_get_theme_option( 'site_name' ) ?: 'Декарт';
|
||
$opt_coords = get_option( 'branch_coords' ) ?: carbon_get_theme_option( 'site_location' ) ?: '';
|
||
|
||
$opt_logistics_walk = get_option( 'branch_logistics_walk', '' );
|
||
$opt_logistics_parking = get_option( 'branch_logistics_parking', '' );
|
||
$opt_logistics_nearby = get_option( 'branch_logistics_schools', '' );
|
||
|
||
$opt_social = get_option( 'branch_social' );
|
||
if ( empty( $opt_social ) || ! is_array( $opt_social ) ) {
|
||
$opt_social = carbon_get_theme_option( 'site_social' );
|
||
}
|
||
?>
|
||
<section class="contacts" id="contacts" aria-label="Контакты">
|
||
<div class="container">
|
||
<div class="contacts__header">
|
||
<span class="bento-label">Контакты</span>
|
||
<h2 class="bento-h2">Наш адрес</h2>
|
||
<p class="bento-p">Ждём вас в гости — удобно добираться из любого района города</p>
|
||
</div>
|
||
<div class="contacts__wrapper">
|
||
<div class="contacts__info">
|
||
<?php if ( ! empty( $opt_phone ) ) : ?>
|
||
<div class="contacts__item">
|
||
<div class="contacts__subtitle">Телефон:</div>
|
||
<a class="contacts__value" href="tel:+<?php echo preg_replace( '/[^0-9]/', '', $opt_phone ); ?>"><?php echo esc_html( $opt_phone ); ?></a>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ( ! empty( $opt_email ) ) : ?>
|
||
<div class="contacts__item">
|
||
<div class="contacts__subtitle">Почта:</div>
|
||
<a class="contacts__value" href="mailto:<?php echo esc_attr( $opt_email ); ?>"><?php echo esc_html( $opt_email ); ?></a>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ( ! empty( $opt_address ) ) : ?>
|
||
<div class="contacts__item">
|
||
<div class="contacts__subtitle">Адрес:</div>
|
||
<div class="contacts__value"><?php echo esc_html( $opt_address ); ?></div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ( $opt_logistics_walk || $opt_logistics_parking || $opt_logistics_nearby ) : ?>
|
||
<div class="contacts__logistics">
|
||
<?php if ( ! empty( $opt_logistics_walk ) ) : ?>
|
||
<span class="contacts__logistics-item">
|
||
<svg class="contacts__logistics-icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z"/><path d="M12 20c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-2Z"/><path d="M10 20H5a2 2 0 0 0-2 2v2"/><path d="M14 22h5a2 2 0 0 0 2-2v-2"/></svg>
|
||
<span class="contacts__logistics-text"><?php echo esc_html( $opt_logistics_walk ); ?></span>
|
||
</span>
|
||
<?php endif; ?>
|
||
<?php if ( ! empty( $opt_logistics_parking ) ) : ?>
|
||
<span class="contacts__logistics-item">
|
||
<svg class="contacts__logistics-icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 17V7h4a3 3 0 0 1 0 6H9"/></svg>
|
||
<span class="contacts__logistics-text"><?php echo esc_html( $opt_logistics_parking ); ?></span>
|
||
</span>
|
||
<?php endif; ?>
|
||
<?php if ( ! empty( $opt_logistics_nearby ) ) : ?>
|
||
<span class="contacts__logistics-item">
|
||
<svg class="contacts__logistics-icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 9.5 12 3l9 6.5"/><path d="M5 12v7a1 1 0 0 0 1 1h5v-5h2v5h5a1 1 0 0 0 1-1v-7"/><path d="M9 10h6v2H9z"/></svg>
|
||
<span class="contacts__logistics-text"><?php echo esc_html( $opt_logistics_nearby ); ?></span>
|
||
</span>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ( ! empty( $opt_social ) && is_array( $opt_social ) ) : ?>
|
||
<div class="contacts__item">
|
||
<div class="contacts__subtitle">Наши соцсети:</div>
|
||
<div class="contacts__social">
|
||
<?php foreach ( $opt_social as $item ) :
|
||
$link = '';
|
||
$name = '';
|
||
if ( is_array( $item ) ) {
|
||
$link = $item['url'] ?? $item['link'] ?? '';
|
||
$name = $item['name'] ?? $item['title'] ?? '';
|
||
} elseif ( is_string( $item ) ) {
|
||
$link = $item;
|
||
}
|
||
if ( $link ) : ?>
|
||
<a class="contacts__social-link" href="<?php echo esc_url( $link ); ?>" target="_blank" rel="noopener noreferrer" title="<?php echo esc_attr( $name ); ?>">
|
||
<?php echo esc_html( $name ?: $link ); ?>
|
||
</a>
|
||
<?php endif; ?>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
<div class="contacts__map">
|
||
<div id="ya-map" style="width: 100%; height: 100%; min-height: 400px;"
|
||
data-coords="<?php echo esc_attr( $opt_coords ?: '55.7558,37.6173' ); ?>"
|
||
data-label="<?php echo esc_attr( $opt_name ?: 'Детский центр «Декарт»' ); ?>"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|