' . esc_html($subtitle) . ''; } endif; if (!function_exists('aksrt_get_single_title_html')) : /** * Title + optional subtitle for single headers. */ function aksrt_get_single_title_html($post_id = null): string { $post_id = $post_id ? (int) $post_id : (int) get_the_ID(); $title = get_the_title($post_id); $sub = function_exists('aksrt_get_the_subtitle') ? aksrt_get_the_subtitle(true, '', $post_id) : ''; return esc_html($title) . $sub; } endif; if (!function_exists('aksrt_get_posts_meta_items_html')) : /** * Zibll-like post meta pills: comment + views + likes. * * @param int|null $post_id Post ID. */ function aksrt_get_posts_meta_items_html($post_id = null): string { $post = get_post($post_id); if (!($post instanceof WP_Post)) { return ''; } $post_id = (int) $post->ID; $html = ''; $comments_closed = function_exists('aksrt_are_comments_closed') ? aksrt_are_comments_closed() : (!comments_open($post_id)); if (comments_open($post_id) && !$comments_closed) { $href = is_single($post_id) ? 'javascript:(typeof scrollTopTo===\'function\'?scrollTopTo(\'#comments\'):void(0));' : get_comments_link($post_id); $count = (int) get_comments_number($post_id); $html .= ''; } $views = function_exists('aksrt_get_post_views') ? (int) aksrt_get_post_views($post_id) : 0; $views_label = function_exists('aksrt_format_number') ? aksrt_format_number($views) : number_format_i18n($views); $html .= ''; $like_on = true; if (class_exists('AKSRT_Settings')) { $page = AKSRT_Settings::get_post_page_settings(); $like_on = !isset($page['like_enabled']) || !empty($page['like_enabled']); } if ($like_on && $post->post_type === 'post') { $likes = function_exists('aksrt_get_post_likes') ? (int) aksrt_get_post_likes($post_id) : 0; $html .= ''; } return $html; } endif; if (!function_exists('aksrt_get_single_meta_box')) : /** * Zibll zib_get_single_meta_box equivalent. * * @param string $class Extra class on wrapper. * @param string $direction Unused (kept for API parity). * @param int|null $post_id Post ID. */ function aksrt_get_single_meta_box(string $class = 'abs-right', string $direction = 'down', $post_id = null): string { if (!is_single() && !is_singular()) { return ''; } $post_id = $post_id ? (int) $post_id : (int) get_the_ID(); $meta = function_exists('aksrt_get_posts_meta_items_html') ? aksrt_get_posts_meta_items_html($post_id) : ''; $more = ''; $edit_link = get_edit_post_link($post_id); $permalink = get_permalink($post_id); $login_url = function_exists('aksrt_get_login_url') ? aksrt_get_login_url() : wp_login_url($permalink ?: home_url('/')); $more .= '
'; return ''; } endif; if (!function_exists('aksrt_get_post_status_badge')) : /** * Non-publish status badge (text badge, Zibll-compatible classes). */ function aksrt_get_post_status_badge($post = null): string { $post = get_post($post); if (!($post instanceof WP_Post)) { return ''; } $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'], 'trash' => ['label' => __('回收站', 'aksrt'), 'class' => 'jb-red'], ]; $status = $post->post_status; if (!isset($map[$status])) { return ''; } return '' . esc_html__('登录后可查看', 'aksrt') . '
'; if ($user_id <= 0) { $data['allow'] = false; $data['not_html'] = aksrt_get_allow_view_deny_shell( __('内容已隐藏,请登录后查看', 'aksrt'), '' . esc_html__('登录后继续查看', 'aksrt') . '
' . '' . esc_html__('以下用户组可查看', 'aksrt') . '
' . $badges . '