2026-09-13 20:35:16 +00:00

73 lines
3.2 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
/**
* E-E-A-T автор, даты и копирайт — универсальный шаблон.
*
* Автор: branch_director_name (Settings) → OG: Site Name → «Частная школа Декарт».
* Должность: branch_director_creds (Settings) → «Образовательный центр с гослицензией».
* Даты: автоматически из WordPress (публикация/обновление).
*
* @package Dekart
*/
if (! defined('ABSPATH')) {
exit;
}
$post_id = get_the_ID();
// ── Поддержка $args (переопределение автора, напр. для single-teacher) ──
$args = isset($args) && is_array($args) ? $args : array();
$args = wp_parse_args($args, array('author_name' => '', 'author_creds' => ''));
// ── Автор: $args → Settings API → fallback ──
$author_name = $args['author_name']
?: get_option('branch_director_name', 'Елена Сергеевна Дегтярёва')
?: carbon_get_post_meta($post_id, 'pksh_author_name')
?: get_option('branch_og_site_name', 'Частная школа Декарт');
$author_creds = $args['author_creds']
?: get_option('branch_director_creds', 'директор частной школы «Декарт», педагогический стаж 18 лет');
// ── Даты (автоматически из WP) ──
$publish_date = $post_id ? get_the_date('c', $post_id) : '';
$modified_date = $post_id ? get_the_modified_date('c', $post_id) : '';
$publish_fmt = $publish_date ? date_i18n('j F Y', strtotime($publish_date)) : '';
$modified_fmt = $modified_date ? date_i18n('j F Y', strtotime($modified_date)) : '';
// ── Город для копирайта ──
$branch_city = get_option('branch_city') ?: 'Щёлково';
if (empty($author_name) && empty($publish_fmt) && empty($modified_fmt)) {
return;
}
?>
<section class="author-info-section section-bg" data-bg="author-info" aria-label="Информация об авторе">
<div class="container">
<div class="author-info__inner">
<div class="author-info__copyright">
&copy; <?php echo esc_html(date_i18n('Y')); ?> Частная школа «Декарт», <?php echo esc_html($branch_city); ?>.
</div>
<?php if ($author_name) : ?>
<div class="author-info__author">
<span class="author-info__label">Автор контента:</span>
<span class="author-info__name"><?php echo esc_html($author_name); ?></span>
<?php if ($author_creds) : ?>
<span class="author-info__creds">— <?php echo esc_html($author_creds); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="author-info__dates">
<?php if ($publish_fmt) : ?>
<span>Дата публикации: <?php echo esc_html($publish_fmt); ?></span>
<?php endif; ?>
<?php if ($modified_fmt) : ?>
<span>Дата обновления: <?php echo esc_html($modified_fmt); ?></span>
<?php endif; ?>
</div>
</div>
</div>
</section>