diff --git a/wp-content/themes/dekart/assets/css/blog.css b/wp-content/themes/dekart/assets/css/blog.css index 3d790fd..8eeb674 100644 --- a/wp-content/themes/dekart/assets/css/blog.css +++ b/wp-content/themes/dekart/assets/css/blog.css @@ -115,3 +115,14 @@ aspect-ratio: 16 / 9; } } + +.page-blog .single-post_author { + margin-top: 8px; + font-size: 0.9375rem; + color: var(--color-text-muted, #475569); +} + +.page-blog .single-post_author a { + color: var(--color-primary, #7c5cfc); + font-weight: 600; +} diff --git a/wp-content/themes/dekart/assets/css/blog.min.css b/wp-content/themes/dekart/assets/css/blog.min.css index 3316baf..7d6aa36 100644 --- a/wp-content/themes/dekart/assets/css/blog.min.css +++ b/wp-content/themes/dekart/assets/css/blog.min.css @@ -1,2 +1,2 @@ /*! blog.css (minified) */ -.page-blog .blog-section{padding: clamp(40px,5.5vw,72px) clamp(16px,3vw,32px);}.page-blog .blog-grid{display: grid;grid-template-columns: repeat(auto-fill,minmax(min(100%,300px),1fr));gap: clamp(16px,2vw,24px);margin-top: clamp(20px,3vw,32px);}.page-blog .blog-card{display: flex;flex-direction: column;overflow: hidden;background: var(--color-bg,#fff);border: 1px solid var(--color-border,#e2e8f0);border-radius: var(--radius-md,16px);box-shadow: 0 2px 12px rgba(15,23,42,0.06);transition: transform 0.25s ease,box-shadow 0.25s ease;}.page-blog .blog-card:hover{transform: translateY(-4px);box-shadow: 0 10px 28px rgba(15,23,42,0.12);}.page-blog .blog-card__link{display: flex;flex-direction: column;height: 100%;color: inherit;text-decoration: none;}.page-blog .blog-card__media{aspect-ratio: 16 / 10;overflow: hidden;background: var(--color-surface-soft,#f1f5f9);}.page-blog .blog-card__media img{width: 100%;height: 100%;object-fit: cover;}.page-blog .blog-card__body{display: flex;flex-direction: column;gap: 8px;padding: 18px;}.page-blog .blog-card__meta{display: flex;flex-wrap: wrap;gap: 8px 14px;font-size: 0.8125rem;color: var(--color-text-muted,#475569);}.page-blog .blog-card__cat{font-weight: 700;color: var(--color-primary,#7c5cfc);}.page-blog .blog-card__title{margin: 0;font-size: clamp(1.0625rem,1.6vw,1.25rem);line-height: 1.3;overflow-wrap: anywhere;}.page-blog .blog-card__excerpt{margin: 0;font-size: 0.9375rem;line-height: 1.55;color: var(--color-text-muted,#475569);overflow-wrap: anywhere;}.page-blog .blog-pagination{display: flex;flex-wrap: wrap;justify-content: center;gap: 10px;margin-top: clamp(24px,3vw,40px);}.page-blog .blog-pagination .page-numbers{display: inline-flex;align-items: center;justify-content: center;min-width: 44px;height: 44px;padding: 0 14px;border: 1px solid var(--color-border,#e2e8f0);border-radius: 999px;background: #fff;color: var(--color-text,#0f172a);font-weight: 600;text-decoration: none;}.page-blog .blog-pagination .page-numbers.current,.page-blog .blog-pagination .page-numbers:hover{background: var(--color-primary,#7c5cfc);border-color: var(--color-primary,#7c5cfc);color: #fff;}@media (max-width: 639px){.page-blog .blog-card__media{aspect-ratio: 16 / 9;}} \ No newline at end of file +.page-blog .blog-section{padding: clamp(40px,5.5vw,72px) clamp(16px,3vw,32px);}.page-blog .blog-grid{display: grid;grid-template-columns: repeat(auto-fill,minmax(min(100%,300px),1fr));gap: clamp(16px,2vw,24px);margin-top: clamp(20px,3vw,32px);}.page-blog .blog-card{display: flex;flex-direction: column;overflow: hidden;background: var(--color-bg,#fff);border: 1px solid var(--color-border,#e2e8f0);border-radius: var(--radius-md,16px);box-shadow: 0 2px 12px rgba(15,23,42,0.06);transition: transform 0.25s ease,box-shadow 0.25s ease;}.page-blog .blog-card:hover{transform: translateY(-4px);box-shadow: 0 10px 28px rgba(15,23,42,0.12);}.page-blog .blog-card__link{display: flex;flex-direction: column;height: 100%;color: inherit;text-decoration: none;}.page-blog .blog-card__media{aspect-ratio: 16 / 10;overflow: hidden;background: var(--color-surface-soft,#f1f5f9);}.page-blog .blog-card__media img{width: 100%;height: 100%;object-fit: cover;}.page-blog .blog-card__body{display: flex;flex-direction: column;gap: 8px;padding: 18px;}.page-blog .blog-card__meta{display: flex;flex-wrap: wrap;gap: 8px 14px;font-size: 0.8125rem;color: var(--color-text-muted,#475569);}.page-blog .blog-card__cat{font-weight: 700;color: var(--color-primary,#7c5cfc);}.page-blog .blog-card__title{margin: 0;font-size: clamp(1.0625rem,1.6vw,1.25rem);line-height: 1.3;overflow-wrap: anywhere;}.page-blog .blog-card__excerpt{margin: 0;font-size: 0.9375rem;line-height: 1.55;color: var(--color-text-muted,#475569);overflow-wrap: anywhere;}.page-blog .blog-pagination{display: flex;flex-wrap: wrap;justify-content: center;gap: 10px;margin-top: clamp(24px,3vw,40px);}.page-blog .blog-pagination .page-numbers{display: inline-flex;align-items: center;justify-content: center;min-width: 44px;height: 44px;padding: 0 14px;border: 1px solid var(--color-border,#e2e8f0);border-radius: 999px;background: #fff;color: var(--color-text,#0f172a);font-weight: 600;text-decoration: none;}.page-blog .blog-pagination .page-numbers.current,.page-blog .blog-pagination .page-numbers:hover{background: var(--color-primary,#7c5cfc);border-color: var(--color-primary,#7c5cfc);color: #fff;}@media (max-width: 639px){.page-blog .blog-card__media{aspect-ratio: 16 / 9;}}.page-blog .single-post_author{margin-top: 8px;font-size: 0.9375rem;color: var(--color-text-muted,#475569);}.page-blog .single-post_author a{color: var(--color-primary,#7c5cfc);font-weight: 600;} \ No newline at end of file diff --git a/wp-content/themes/dekart/functions.php b/wp-content/themes/dekart/functions.php index 3dd02fd..0ee430e 100644 --- a/wp-content/themes/dekart/functions.php +++ b/wp-content/themes/dekart/functions.php @@ -1971,6 +1971,17 @@ function add_carbon() + Container::make('post_meta', '👤 Автор статьи') + ->where('post_type', '=', 'post') + ->add_fields(array( + Field::make('association', 'post_author_teacher', 'Автор-педагог (CPT Преподаватели)') + ->set_types(array( + array( 'type' => 'post', 'post_type' => 'teacher' ), + )) + ->set_max(1) + ->set_help_text('ФИО и ссылка на профиль педагога в байлайне статьи и Schema.org BlogPosting. Пусто — берётся общий автор из настроек филиала.'), + )); + Container::make('post_meta', 'Поля для преподавателя') ->where('post_type', '=', 'teacher') ->add_tab('🎬 Hero', array( @@ -5941,6 +5952,40 @@ function dekart_branch_add_menu() add_action('admin_init', 'dekart_branch_register_settings'); +function dekart_post_author(int $post_id = 0): array +{ + $post_id = $post_id ?: (int) get_the_ID(); + + if ($post_id && function_exists('carbon_get_post_meta')) { + $raw = carbon_get_post_meta($post_id, 'post_author_teacher'); + $first = is_array($raw) ? ( $raw[0] ?? null ) : $raw; + if (is_array($first)) { + $first = $first['value'] ?? ''; + } + $tid = 0; + if (is_numeric($first)) { + $tid = (int) $first; + } elseif (is_string($first) && preg_match('/:(\d+)$/', $first, $m)) { + $tid = (int) $m[1]; + } + if ($tid) { + return array( + 'name' => (string) get_the_title($tid), + 'url' => (string) get_permalink($tid), + 'is_teacher' => true, + ); + } + } + + $canon = function_exists('dekart_author_canon') ? dekart_author_canon() : array( 'name' => '' ); + return array( + 'name' => (string) ( $canon['name'] ?? '' ), + 'url' => '', + 'is_teacher' => false, + ); +} + + function dekart_author_defaults(): array { return array( diff --git a/wp-content/themes/dekart/inc/schema.php b/wp-content/themes/dekart/inc/schema.php index 3a422c9..85e5051 100644 --- a/wp-content/themes/dekart/inc/schema.php +++ b/wp-content/themes/dekart/inc/schema.php @@ -1543,7 +1543,7 @@ function dekart_blog_jsonld(): void if ($is_post) { $post_id = (int) get_the_ID(); - $canon = dekart_author_canon(); + $canon = dekart_author_canon(); // phpcs:ignore $pub_name = (string) get_option('branch_og_site_name'); if ('' === trim($pub_name)) { $pub_name = (string) get_option('branch_name'); @@ -1552,6 +1552,12 @@ function dekart_blog_jsonld(): void $pub_name = (string) get_bloginfo('name'); } + $pa = function_exists('dekart_post_author') ? dekart_post_author($post_id) : array( 'name' => '', 'url' => '' ); + $author_person = array( '@type' => 'Person', 'name' => wp_strip_all_tags((string) $pa['name']) ); + if ('' !== (string) $pa['url']) { + $author_person['url'] = (string) $pa['url']; + } + $posting = array( '@context' => 'https://schema.org', '@type' => 'BlogPosting', @@ -1559,7 +1565,7 @@ function dekart_blog_jsonld(): void 'headline' => wp_strip_all_tags(get_the_title($post_id)), 'datePublished' => get_the_date('c', $post_id), 'dateModified' => get_the_modified_date('c', $post_id), - 'author' => array( '@type' => 'Person', 'name' => wp_strip_all_tags((string) $canon['name']) ), + 'author' => $author_person, 'publisher' => array( '@type' => 'Organization', 'name' => wp_strip_all_tags($pub_name), 'url' => $home . '/' ), ); $desc = wp_strip_all_tags(get_the_excerpt($post_id)); @@ -1574,7 +1580,7 @@ function dekart_blog_jsonld(): void $crumbs = array( array( '@type' => 'ListItem', 'position' => 1, 'name' => 'Главная', 'item' => $home . '/' ), - array( '@type' => 'ListItem', 'position' => 2, 'name' => 'Блог', 'item' => $blog_url ), + array( '@type' => 'ListItem', 'position' => 2, 'name' => 'Статьи', 'item' => $blog_url ), ); if ($is_post) { $crumbs[] = array( '@type' => 'ListItem', 'position' => 3, 'name' => wp_strip_all_tags(get_the_title()), 'item' => get_permalink() ); diff --git a/wp-content/themes/dekart/page-news.php b/wp-content/themes/dekart/page-news.php deleted file mode 100644 index eb8eff4..0000000 --- a/wp-content/themes/dekart/page-news.php +++ /dev/null @@ -1,56 +0,0 @@ - - -
- -
-
-

- - -1, - 'offset' => 0, - 'orderby' => 'date', - 'order' => 'DESC', - 'post_type' => 'post', - ); - $query = new WP_Query($args); ?> - -
- have_posts()) { - $query->the_post(); - $post_id = get_the_ID(); - $cat = get_the_category($post_id); - ?> - - -
-
-
- - - -
- -
- Блог + Статьи

-
  • Блог
  • +
  • Статьи
  • @@ -21,7 +21,14 @@ $cat = get_the_category($post_id);