From 29bd9bd15225f967b23a186730922d2a6c0e5cb8 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jul 2026 21:49:46 +0800 Subject: [PATCH] =?UTF-8?q?Zibll=20=E4=B8=BB=E7=BA=BF=E6=94=B6=E5=8F=A3?= =?UTF-8?q?=EF=BC=9A=E5=87=8F=E5=B1=82=E7=BB=9F=E4=B8=80=20single=20?= =?UTF-8?q?=E4=B8=8E=E9=A6=96=E9=A1=B5=E4=B8=BB=E5=86=85=E5=AE=B9=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 把 single.php 收成薄壳,文章组合迁入 aksrt-single; 首页去掉 legacy module 桥接与多余 stream 文案层, 保留 renderer / tab-panel / sort 协议并形成页面自有 aside。 --- inc/bootstrap.php | 1 + inc/helpers/aksrt-homepage.php | 93 ++-- inc/helpers/aksrt-single.php | 706 ++++++++++++++++++++++++++ single.php | 518 +++---------------- templates/parts/single-author-bar.php | 30 +- 5 files changed, 825 insertions(+), 523 deletions(-) create mode 100644 inc/helpers/aksrt-single.php diff --git a/inc/bootstrap.php b/inc/bootstrap.php index 945ee557..03d2d572 100644 --- a/inc/bootstrap.php +++ b/inc/bootstrap.php @@ -27,6 +27,7 @@ require_once AKSRT_DIR . '/inc/helpers/aksrt-template-tags.php'; require_once AKSRT_DIR . '/inc/helpers/aksrt-frontend-tags.php'; require_once AKSRT_DIR . '/inc/helpers/aksrt-flow.php'; require_once AKSRT_DIR . '/inc/helpers/aksrt-homepage.php'; +require_once AKSRT_DIR . '/inc/helpers/aksrt-single.php'; require_once AKSRT_DIR . '/inc/helpers/aksrt-slider.php'; require_once AKSRT_DIR . '/inc/helpers/aksrt-vip.php'; require_once AKSRT_DIR . '/inc/helpers/aksrt-i18n-switch.php'; diff --git a/inc/helpers/aksrt-homepage.php b/inc/helpers/aksrt-homepage.php index 392d87f1..11d5eabf 100644 --- a/inc/helpers/aksrt-homepage.php +++ b/inc/helpers/aksrt-homepage.php @@ -764,35 +764,38 @@ if (!function_exists('aksrt_homepage_render_posts_grid')) { } } -if (!function_exists('aksrt_homepage_render_system_module')) { +if (!function_exists('aksrt_homepage_render_section')) { /** - * Render a legacy homepage module inside the fixed homepage layout. + * Render a first-class homepage section (hero / banner). + * + * These are fixed homepage sections, not a freeform module canvas bridge. */ - function aksrt_homepage_render_system_module(string $type, string $wrapper_class = 'home-modules', array $config = []): void { + function aksrt_homepage_render_section(string $type): void { $type = sanitize_key($type); - if ($type === '') { + if (!in_array($type, ['hero', 'banner'], true)) { return; } - set_query_var('aksrt_module_config', $config); ob_start(); get_template_part('templates/parts/home-modules/module', $type); - set_query_var('aksrt_module_config', null); - $module_html = trim((string) ob_get_clean()); - - if ($module_html === '') { + $html = trim((string) ob_get_clean()); + if ($html === '') { return; } - echo '
'; - echo $module_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + $class = $type === 'hero' + ? 'aksrt-homepage__hero home-modules home-modules--fullbleed' + : 'aksrt-homepage__banner home-modules'; + + echo '
'; + echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '
'; } } if (!function_exists('aksrt_homepage_render_layout')) { /** - * Render the fixed homepage layout directly. + * Render the fixed homepage layout (Zibll latest-first content stream). */ function aksrt_homepage_render_layout(): void { $current_page = aksrt_homepage_get_current_page(); @@ -807,18 +810,15 @@ if (!function_exists('aksrt_homepage_render_layout')) { ? AKSRT_Settings::home_list_title() : __('最新发布', 'aksrt'); ?> -
+
@@ -831,34 +831,19 @@ if (!function_exists('aksrt_homepage_render_layout')) { 'aksrt-homepage__content-zone aksrt-homepage__content-zone--top' ); - if ($banner_on) { - aksrt_homepage_render_system_module('banner', 'aksrt-homepage__content-zone aksrt-homepage__content-zone--banner aksrt-homepage__system-modules home-modules'); + if ($banner_on && function_exists('aksrt_homepage_render_section')) { + aksrt_homepage_render_section('banner'); } - ?> -
-
-
-

-

-
- -
- +
-
-
    +
    +
      @@ -876,29 +861,27 @@ if (!function_exists('aksrt_homepage_render_layout')) {
    +
    1) : ?> -
    +
    - - - + + +
    + +
    +
    +
    -
    -
    +
    +
    diff --git a/inc/helpers/aksrt-single.php b/inc/helpers/aksrt-single.php new file mode 100644 index 00000000..1d75c9f4 --- /dev/null +++ b/inc/helpers/aksrt-single.php @@ -0,0 +1,706 @@ + + */ + function aksrt_single_build_context($post_id = null): array { + $post_id = $post_id ? (int) $post_id : (int) get_the_ID(); + $settings = function_exists('aksrt_resolve_single_post_display_settings') + ? aksrt_resolve_single_post_display_settings($post_id) + : []; + + $views = function_exists('aksrt_get_post_views') ? (int) aksrt_get_post_views($post_id) : 0; + $comment_count = (int) get_comments_number($post_id); + $like_count = function_exists('aksrt_get_post_likes') ? (int) aksrt_get_post_likes($post_id) : 0; + $favorite_count = function_exists('aksrt_get_post_favorites') ? (int) aksrt_get_post_favorites($post_id) : 0; + $word_count = function_exists('aksrt_post_word_count') && !empty($settings['word_count_enabled']) + ? aksrt_post_word_count($post_id) + : 0; + $reading_minutes = function_exists('aksrt_reading_minutes') && !empty($settings['reading_time_enabled']) + ? aksrt_reading_minutes($post_id) + : 0; + + $meta_items = []; + if (empty($settings['hide_time'])) { + $meta_items[] = [ + 'icon' => 'far fa-calendar-alt', + 'text' => get_the_date('', $post_id), + ]; + } + $meta_items[] = [ + 'icon' => 'far fa-eye', + 'text' => sprintf( + __('浏览 %s', 'aksrt'), + function_exists('aksrt_format_number') ? aksrt_format_number($views) : number_format_i18n($views) + ), + ]; + $meta_items[] = [ + 'icon' => 'far fa-comment-dots', + 'text' => sprintf(__('评论 %s', 'aksrt'), number_format_i18n($comment_count)), + ]; + if ($word_count > 0) { + $meta_items[] = [ + 'icon' => 'far fa-file-word', + 'text' => sprintf(__('约 %s 字', 'aksrt'), number_format_i18n($word_count)), + ]; + } + if ($reading_minutes > 0) { + $meta_items[] = [ + 'icon' => 'far fa-hourglass', + 'text' => sprintf(_n('约 %d 分钟', '约 %d 分钟', $reading_minutes, 'aksrt'), $reading_minutes), + ]; + } + + $copyright = trim((string) ($settings['copyright_text'] ?? '')); + if ($copyright === '') { + $copyright = sprintf( + __('本文由 %s 原创发布,转载请注明出处。', 'aksrt'), + get_the_author_meta('display_name', (int) get_post_field('post_author', $post_id)) + ); + } + + $paid_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_paid_content_settings() : []; + $paid_display = is_array($paid_settings['display'] ?? null) ? $paid_settings['display'] : []; + $paid_box_position = (string) ($paid_display['box_position'] ?? 'top'); + if ($paid_box_position === 'box_top') { + $paid_box_position = 'top'; + } elseif ($paid_box_position === 'box_bottom') { + $paid_box_position = 'bottom'; + } + if (!in_array($paid_box_position, ['top', 'bottom'], true)) { + $paid_box_position = 'top'; + } + + $show_cover = !empty($settings['show_cover']) && (string) ($settings['cover_url'] ?? '') !== ''; + $show_toc = !empty($settings['toc_enabled']); + $has_download = function_exists('aksrt_is_downloadable_content') && aksrt_is_downloadable_content($post_id); + + $breadcrumbs_html = ''; + if (!empty($settings['breadcrumbs']) && function_exists('aksrt_breadcrumbs')) { + ob_start(); + aksrt_breadcrumbs($settings['breadcrumbs_home'] ?? ''); + $breadcrumbs_html = trim((string) ob_get_clean()); + } + + $status_badge = ''; + $post_status = get_post_status($post_id); + if ($post_status && $post_status !== 'publish') { + $status_map = [ + 'draft' => ['label' => __('草稿', 'aksrt'), 'class' => 'jb-yellow'], + 'pending' => ['label' => __('待审核', 'aksrt'), 'class' => 'jb-red'], + 'private' => ['label' => __('私密', 'aksrt'), 'class' => 'b-black opacity8'], + 'future' => ['label' => __('定时发布', 'aksrt'), 'class' => 'c-blue'], + ]; + if (isset($status_map[$post_status])) { + $status_badge = '' + . esc_html($status_map[$post_status]['label']) . ''; + } + } + + $aside_widgets = is_active_sidebar('sidebar-article') + || is_active_sidebar('all_sidebar_top') + || is_active_sidebar('all_sidebar_bottom'); + + return [ + 'post_id' => $post_id, + 'settings' => $settings, + 'show_cover' => $show_cover, + 'show_toc' => $show_toc, + 'cover_url' => (string) ($settings['cover_url'] ?? ''), + 'cover_type' => (string) ($settings['cover_type'] ?? 'none'), + 'img_scale' => (int) ($settings['article_image_cover_scale'] ?? 35), + 'video_scale' => (int) ($settings['article_video_cover_scale'] ?? 56), + 'slide_images' => array_values(array_filter((array) ($settings['slide_images'] ?? []))), + 'episode_count' => max(0, (int) get_post_meta($post_id, '_aksrt_featured_video_episode', true)), + 'meta_items' => $meta_items, + 'views' => $views, + 'comment_count' => $comment_count, + 'like_count' => $like_count, + 'favorite_count' => $favorite_count, + 'is_liked' => function_exists('aksrt_is_post_liked') ? aksrt_is_post_liked($post_id) : false, + 'is_favorited' => function_exists('aksrt_is_post_favorited') ? aksrt_is_post_favorited($post_id) : false, + 'copyright_text' => $copyright, + 'front_content' => (string) ($settings['front_content'] ?? ''), + 'after_content' => (string) ($settings['after_content'] ?? ''), + 'content_maxheight' => !empty($settings['maxheight_enabled']) ? max(0, (int) ($settings['maxheight'] ?? 0)) : 0, + 'has_download' => $has_download, + 'paid_box_position' => $paid_box_position, + 'breadcrumbs_html' => $breadcrumbs_html, + 'status_badge' => $status_badge, + 'show_aside' => $aside_widgets || $show_toc || $has_download, + 'toc_title' => __('文章目录', 'aksrt'), + ]; + } +endif; + +if (!function_exists('aksrt_single_is_docs_page')) : + /** + * Docs fast-path: true when the current post should leave the unified single surface. + */ + function aksrt_single_is_docs_page(int $post_id): bool { + if (!class_exists('AKSRT_Docs_Presenter')) { + return false; + } + return (bool) AKSRT_Docs_Presenter::get_instance()->is_docs_page($post_id); + } +endif; + +if (!function_exists('aksrt_single_render_author_bar')) : + /** + * Render author bar from a real args array (no ambient query vars). + * + * @param array $args Partial args. + */ + function aksrt_single_render_author_bar(array $args = []): void { + $args = wp_parse_args($args, [ + 'extra_class' => '', + 'show_actions' => false, + 'show_bio' => false, + 'meta_items' => [], + ]); + get_template_part('templates/parts/single-author-bar', null, $args); + } +endif; + +if (!function_exists('aksrt_single_render_cover')) : + /** + * Cover / slide / video header. + * + * @param array $ctx Single context. + */ + function aksrt_single_render_cover(array $ctx): void { + if (empty($ctx['show_cover']) || $ctx['cover_url'] === '') { + return; + } + + $type = (string) $ctx['cover_type']; + $badge = (string) $ctx['status_badge']; + $crumbs = (string) $ctx['breadcrumbs_html']; + $meta_items = is_array($ctx['meta_items'] ?? null) ? $ctx['meta_items'] : []; + $img_scale = (int) $ctx['img_scale']; + $video_scale = (int) $ctx['video_scale']; + $episode = (int) $ctx['episode_count']; + $slides = is_array($ctx['slide_images'] ?? null) ? $ctx['slide_images'] : []; + + if ($type === 'video') : + ?> +
    + +
    +
    + +
    + +

    + +
    + + + +
    + 0) : ?> + + +
    +
    + +
    +
    + $slide_url) : ?> +
    + <?php echo esc_attr(get_the_title()); ?> +
    + +
    +
    +
    + +
    + +

    + +
    + + + +
    + +
    +
    + +
    + <?php echo esc_attr(get_the_title()); ?> +
    +
    + +
    + +

    + +
    + + + +
    +
    +
    + $ctx Single context. + */ + function aksrt_single_render_box_header(array $ctx): void { + $settings = is_array($ctx['settings'] ?? null) ? $ctx['settings'] : []; + ?> +
    + + +

    + + + + true, + 'meta_items' => empty($ctx['show_cover']) ? (array) $ctx['meta_items'] : [], + ]); + ?> + +
    + $ctx Single context. + */ + function aksrt_single_render_actions(array $ctx): void { + $settings = is_array($ctx['settings'] ?? null) ? $ctx['settings'] : []; + $post_id = (int) $ctx['post_id']; + $like_count = (int) $ctx['like_count']; + $favorite_count = (int) $ctx['favorite_count']; + $is_liked = !empty($ctx['is_liked']); + $is_favorited = !empty($ctx['is_favorited']); + ?> +
    +
    + + + + + + + + + + + + + + + +
    + + + + + + + + + $ctx Single context. + */ + function aksrt_single_render_content_footer(array $ctx): void { + $settings = is_array($ctx['settings'] ?? null) ? $ctx['settings'] : []; + $post_id = (int) $ctx['post_id']; + ?> + +
    + + + +
    +
    ©
    + +
    + + +
    THE END
    + + $ctx Single context. + */ + function aksrt_single_render_author_card(array $ctx): void { + if (!function_exists('aksrt_get_user_dashboard_view')) { + return; + } + + $author_id = (int) get_the_author_meta('ID'); + $dashboard = aksrt_get_user_dashboard_view($author_id, ['viewer_id' => get_current_user_id()]); + $recent = is_array($dashboard['recent_posts'] ?? null) ? $dashboard['recent_posts'] : []; + $stats = [ + ['label' => __('文章', 'aksrt'), 'value' => (int) ($dashboard['post_count'] ?? 0)], + ['label' => __('评论', 'aksrt'), 'value' => (int) ($dashboard['comment_count'] ?? 0)], + ['label' => __('收藏', 'aksrt'), 'value' => (int) ($dashboard['favorite_count'] ?? 0)], + ]; + $bio = trim((string) get_the_author_meta('description')); + ?> +
    +
    + + + +
    + + +

    + +
    + + + +
    +
    +
    + +
    +

    +
      + + +
    • + + +
    +
    + +
    + + + $ctx Single context. + */ + function aksrt_single_render_related(array $ctx): void { + $settings = is_array($ctx['settings'] ?? null) ? $ctx['settings'] : []; + if (empty($settings['related_enabled']) || !function_exists('aksrt_render_post_list')) { + return; + } + + $post_id = (int) $ctx['post_id']; + $count = max(1, min(12, (int) ($settings['related_count'] ?? 6))); + $title = (string) ($settings['related_title'] ?? ''); + $args = [ + 'post_type' => get_post_type($post_id), + 'post_status' => 'publish', + 'post__not_in' => [$post_id], + 'posts_per_page' => $count, + 'ignore_sticky_posts' => true, + ]; + + if (($settings['related_type'] ?? 'category') === 'tag') { + $tag_ids = wp_get_post_terms($post_id, 'post_tag', ['fields' => 'ids']); + if (!empty($tag_ids) && !is_wp_error($tag_ids)) { + $args['tag__in'] = $tag_ids; + } + } else { + $cat_ids = wp_get_post_terms($post_id, 'category', ['fields' => 'ids']); + if (!empty($cat_ids) && !is_wp_error($cat_ids)) { + $args['category__in'] = $cat_ids; + } + } + + $query = new WP_Query($args); + if (!$query->have_posts()) { + wp_reset_postdata(); + return; + } + ?> + + $ctx Single context. + */ + function aksrt_single_render_article(array $ctx): void { + $settings = is_array($ctx['settings'] ?? null) ? $ctx['settings'] : []; + $maxheight = (int) $ctx['content_maxheight']; + ?> +
    > + + + +
    + + + + + +
    + +
    + + + +
    + + +
    + + '

    ', + 'after' => '

    ', + ]); + ?> +
    + + +
    + + + +
    + +
    + + + + +
    + $ctx Single context. + */ + function aksrt_single_render_after_box(array $ctx): void { + $settings = is_array($ctx['settings'] ?? null) ? $ctx['settings'] : []; + + if (!empty($settings['authordesc'])) { + aksrt_single_render_author_card($ctx); + } + + aksrt_single_render_prevnext(); + aksrt_single_render_related($ctx); + } +endif; + +if (!function_exists('aksrt_single_render_aside')) : + /** + * Page-owned single aside (not a generic sidebar prepend hack). + * + * @param array $ctx Single context. + */ + function aksrt_single_render_aside(array $ctx): void { + if (empty($ctx['show_aside']) || wp_is_mobile()) { + return; + } + ?> + + |null $ctx Optional prebuilt context. + */ + function aksrt_single(?array $ctx = null): void { + $ctx = is_array($ctx) ? $ctx : aksrt_single_build_context(); + + if (empty($ctx['show_cover'])) { + if ($ctx['breadcrumbs_html'] !== '') { + echo $ctx['breadcrumbs_html']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } elseif (function_exists('aksrt_breadcrumbs')) { + $settings = is_array($ctx['settings'] ?? null) ? $ctx['settings'] : []; + aksrt_breadcrumbs($settings['breadcrumbs_home'] ?? ''); + } + } else { + aksrt_single_render_cover($ctx); + } + + do_action('aksrt_single_before', get_post()); + aksrt_single_render_article($ctx); + do_action('aksrt_single_article_after', get_post()); + aksrt_single_render_after_box($ctx); + do_action('aksrt_single_after', get_post()); + } +endif; diff --git a/single.php b/single.php index 023136c7..a2d321ce 100644 --- a/single.php +++ b/single.php @@ -1,6 +1,8 @@ 'far fa-calendar-alt', - 'text' => get_the_date(), - ]; - } - $author_meta_items[] = [ - 'icon' => 'far fa-eye', - 'text' => sprintf(__('浏览 %s', 'aksrt'), function_exists('aksrt_format_number') ? aksrt_format_number($views) : number_format_i18n($views)), - ]; - $author_meta_items[] = [ - 'icon' => 'far fa-comment-dots', - 'text' => sprintf(__('评论 %s', 'aksrt'), number_format_i18n($comment_count)), - ]; + $post_id = (int) get_the_ID(); + $ctx = function_exists('aksrt_single_build_context') + ? aksrt_single_build_context($post_id) + : ['show_aside' => false, 'settings' => []]; - if ($word_count > 0) { - $author_meta_items[] = [ - 'icon' => 'far fa-file-word', - 'text' => sprintf(__('约 %s 字', 'aksrt'), number_format_i18n($word_count)), - ]; - } - if ($reading_minutes > 0) { - $author_meta_items[] = [ - 'icon' => 'far fa-hourglass', - 'text' => sprintf(_n('约 %d 分钟', '约 %d 分钟', $reading_minutes, 'aksrt'), $reading_minutes), - ]; + if (function_exists('aksrt_single_is_docs_page') && aksrt_single_is_docs_page($post_id)) { + get_template_part('templates/pages/page-documentnav'); + get_footer(); + return; } - $copyright_text = trim((string) ($single_settings['copyright_text'] ?? '')); - if ($copyright_text === '') { - $copyright_text = sprintf( - __('本文由 %s 原创发布,转载请注明出处。', 'aksrt'), - get_the_author() - ); - } - - $show_action_card = !empty($single_settings['like_enabled']) - || !empty($single_settings['favorite_enabled']) - || !empty($single_settings['share_enabled']) - || !empty($single_settings['print_enabled']) - || !empty($single_settings['pdf_export_enabled']); - $has_sidebar_widgets = is_active_sidebar('sidebar-article'); - $show_sidebar = $has_sidebar_widgets || $show_toc; - $cover_breadcrumbs_html = ''; - if (!empty($single_settings['breadcrumbs']) && function_exists('aksrt_breadcrumbs')) { - ob_start(); - aksrt_breadcrumbs($single_settings['breadcrumbs_home'] ?? ''); - $cover_breadcrumbs_html = trim((string) ob_get_clean()); - } - $post_front_content = (string) ($single_settings['front_content'] ?? ''); - $post_after_content = (string) ($single_settings['after_content'] ?? ''); - $content_maxheight = !empty($single_settings['maxheight_enabled']) ? max(0, (int) ($single_settings['maxheight'] ?? 0)) : 0; - $post_toc_title = __('文章目录', 'aksrt'); - $post_toc_widget = ''; - $post_toc_drawer = ''; - $post_share_dropdown = ''; - $post_reward_modal = ''; - $post_sidebar_prepend = ''; - $post_episode_count = max(0, (int) get_post_meta($post_id, '_aksrt_featured_video_episode', true)); - $post_slide_images = array_values(array_filter((array) ($single_settings['slide_images'] ?? []))); - $author_card_html = ''; - $has_download_capability = function_exists('aksrt_is_downloadable_content') && aksrt_is_downloadable_content($post_id); - $paid_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_paid_content_settings() : []; - $paid_display_settings = is_array($paid_settings['display'] ?? null) ? $paid_settings['display'] : []; - $paid_box_position = (string) ($paid_display_settings['box_position'] ?? 'top'); - if ($paid_box_position === 'box_top') { - $paid_box_position = 'top'; - } elseif ($paid_box_position === 'box_bottom') { - $paid_box_position = 'bottom'; - } - if (!in_array($paid_box_position, ['top', 'bottom'], true)) { - $paid_box_position = 'top'; - } - if (class_exists('AKSRT_Docs_Presenter')) { - $docs_presenter = AKSRT_Docs_Presenter::get_instance(); - if ($docs_presenter->is_docs_page($post_id)) { - get_template_part('templates/pages/page-documentnav'); - get_footer(); - return; - } - } - if (!empty($single_settings['share_enabled'])) { - $post_share_dropdown = ''; - } - if (!empty($single_settings['rewards_enabled']) && !empty($single_settings['rewards_image'])) { - $post_reward_modal = ''; - } - if ($show_toc) { - $post_toc_widget = '

    ' . esc_html($post_toc_title) . '

      '; - $post_toc_drawer = '' - . '
      ' - . ''; - } - if (function_exists('aksrt_get_user_dashboard_view')) { - $author_dashboard = aksrt_get_user_dashboard_view((int) get_the_author_meta('ID'), ['viewer_id' => get_current_user_id()]); - $author_recent_posts = is_array($author_dashboard['recent_posts'] ?? null) ? $author_dashboard['recent_posts'] : []; - $author_card_stats = [ - ['label' => __('文章', 'aksrt'), 'value' => (int) ($author_dashboard['post_count'] ?? 0)], - ['label' => __('评论', 'aksrt'), 'value' => (int) ($author_dashboard['comment_count'] ?? 0)], - ['label' => __('收藏', 'aksrt'), 'value' => (int) ($author_dashboard['favorite_count'] ?? 0)], - ]; - $author_card_html = '
      ' - . '
      ' - . '' . get_avatar((int) get_the_author_meta('ID'), 56, '', esc_attr(get_the_author())) . '' - . '
      ' . esc_html(get_the_author()) . ''; - $author_bio = trim((string) get_the_author_meta('description')); - if ($author_bio !== '') { - $author_card_html .= '

      ' . esc_html($author_bio) . '

      '; - } - $author_card_html .= '
      '; - foreach ($author_card_stats as $stat) { - $author_card_html .= '' . esc_html((string) $stat['value']) . ' ' . esc_html($stat['label']) . ''; - } - $author_card_html .= '
      '; - if (!empty($author_recent_posts)) { - $author_card_html .= '

      ' . esc_html__('最新文章', 'aksrt') . '

      '; - } - $author_card_html .= '
      '; - } - $post_status_badge = ''; - $post_status = get_post_status($post_id); - if ($post_status && $post_status !== 'publish') { - $status_map = [ - 'draft' => ['label' => __('草稿', 'aksrt'), 'class' => 'jb-yellow'], - 'pending' => ['label' => __('待审核', 'aksrt'), 'class' => 'jb-red'], - 'private' => ['label' => __('私密', 'aksrt'), 'class' => 'b-black opacity8'], - 'future' => ['label' => __('定时发布', 'aksrt'), 'class' => 'c-blue'], - ]; - if (isset($status_map[$post_status])) { - $post_status_badge = '' . esc_html($status_map[$post_status]['label']) . ''; - } - } + $settings = is_array($ctx['settings'] ?? null) ? $ctx['settings'] : []; + $show_aside = !empty($ctx['show_aside']); ?> - +
      -
      -
      + +
      + + +
      + + +
      +
      +
      -
      - - - - -
      > - -
      - -
      -
      - -
      - -

      - - - -
      - - - -
      - 0) : ?> - - -
      -
      - -
      -
      - $slide_url) : ?> -
      - <?php echo esc_attr(get_the_title()); ?> -
      - -
      -
      -
      - -
      - -

      - - - -
      - - - -
      - - - -
      -
      - -
      - <?php echo esc_attr(get_the_title()); ?> -
      -
      - -
      - -

      - - - -
      - - - -
      -
      -
      - - - -
      -

      - - - -
      - - - - -
      - -
      - - - - -
      - - - - - -
      - -
      - - - +
      - + - -
      - + -
      - - '

      ', - 'after' => '

      ', - ]); - ?> + +
      +
      - -
      - + - -
      - -
      - - - - - - -
      -
      - - - - - - - - - - - - - - -
      - - - - - - - - -
      - - - -
      ©
      - -
      THE END
      - - - - - - - - get_post_type($post_id), - 'post_status' => 'publish', - 'post__not_in' => [$post_id], - 'posts_per_page' => $related_count, - 'ignore_sticky_posts' => true, - ]; - if (($single_settings['related_type'] ?? 'category') === 'tag') { - $tag_ids = wp_get_post_terms($post_id, 'post_tag', ['fields' => 'ids']); - if (!empty($tag_ids) && !is_wp_error($tag_ids)) { - $related_args['tag__in'] = $tag_ids; - } - } else { - $cat_ids = wp_get_post_terms($post_id, 'category', ['fields' => 'ids']); - if (!empty($cat_ids) && !is_wp_error($cat_ids)) { - $related_args['category__in'] = $cat_ids; - } - } - $related_query = new WP_Query($related_args); - if ($related_query->have_posts()) : - ?> - - - - - +
      - -
      - - -
      +
      - - - +
      + +
      + + +
      + + + + +
      + + + diff --git a/templates/parts/single-author-bar.php b/templates/parts/single-author-bar.php index 1d475162..cd67ad66 100644 --- a/templates/parts/single-author-bar.php +++ b/templates/parts/single-author-bar.php @@ -1,30 +1,40 @@ @@ -36,7 +46,7 @@ $classes = trim('article-avatar ' . $extra_class . ($show_actions ? ' article-av
      - +
      -