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

64 lines
2.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
/**
* Информация об авторе и датах публикации (E-E-A-T / GEO)
* Выводится после внешних отзывов, перед финальным CTA.
*
* @package Dekart
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$data = Pksh_Data::instance();
$author_name = $data->get_author_name();
$publish_date = $data->get_page_publish_date();
$modified_date = $data->get_page_modified_date();
$author_years = $data->get_years_on_market();
// Должность автора — хардкор + авто-расчёт лет на рынке
$author_title = 'Образовательный центр с гослицензией';
if ( $author_years > 0 ) {
$author_title .= ', ' . $author_years . ' лет на рынке';
}
// Форматируем даты для отображения
$publish_formatted = $publish_date ? date_i18n( 'j F Y', strtotime( $publish_date ) ) : '';
$modified_formatted = $modified_date ? date_i18n( 'j F Y', strtotime( $modified_date ) ) : '';
// Если нет автора и нет дат — не выводим секцию
if ( empty( $author_name ) && empty( $publish_formatted ) && empty( $modified_formatted ) && $author_years < 1 ) {
return;
}
?>
<section class="bento pksh-section pksh-section--author" aria-label="Информация об авторе">
<div class="bento__full">
<div class="author-info">
<?php if ( ! empty( $author_name ) ) : ?>
<div class="author-info__block">
<span class="author-info__label">Автор:</span>
<span class="author-info__name"><?php echo esc_html( $author_name ); ?></span>
<?php if ( ! empty( $author_title ) ) : ?>
<span class="author-info__title">, <?php echo esc_html( $author_title ); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ( ! empty( $publish_formatted ) ) : ?>
<div class="author-info__block">
<span class="author-info__label">Опубликовано:</span>
<time class="author-info__date" datetime="<?php echo esc_attr( $publish_date ); ?>"><?php echo esc_html( $publish_formatted ); ?></time>
</div>
<?php endif; ?>
<?php if ( ! empty( $modified_formatted ) && $modified_formatted !== $publish_formatted ) : ?>
<div class="author-info__block">
<span class="author-info__label">Обновлено:</span>
<time class="author-info__date" datetime="<?php echo esc_attr( $modified_date ); ?>"><?php echo esc_html( $modified_formatted ); ?></time>
</div>
<?php endif; ?>
</div>
</div>
</section>