$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'];
// 参考主题 article_image_cover_option.scale:20-200(%),标题预留 50px。
$img_scale = max(20, min(200, (int) $ctx['img_scale']));
// 参考主题 article_video_cover_option.scale:0-200,0 = 不固定长宽比 → 16:9 回退。
$video_scale = max(0, min(200, (int) $ctx['video_scale']));
$video_padding = $video_scale > 0 ? (string) $video_scale : '56.25';
$slides = is_array($ctx['slide_images'] ?? null) ? $ctx['slide_images'] : [];
$poster = (string) ($ctx['video_poster'] ?? '');
$title_html = (string) ($ctx['title_html'] ?? esc_html(get_the_title()));
if ($type === 'video') :
// 视频封面高度为裸比例(对齐参考主题 .dplayer-scale-height 契约):
// 标题/面包屑在下方 .single-video-footer,不叠加封面,无 +50px 补偿;
// 单图/多图封面标题叠加封面,才需要 calc(scale% + 50px)。
?>
'
. '
' . $title_html . '
'
. ($crumbs !== '' ? $crumbs : '')
. $badge
. '';
// 幻灯片配置(参考主题 CFS_Module::slide 全字段,经 get_post_page_settings 归一化)。
$slide_option = is_array($ctx['settings']['article_slide_cover_option'] ?? null)
? $ctx['settings']['article_slide_cover_option']
: [];
$single_slide = count($slide_items) === 1;
$slider_args = [
'slides' => $slide_items,
'effect' => (string) ($slide_option['effect'] ?? 'slide'),
'direction' => (string) ($slide_option['direction'] ?? 'horizontal'),
'spaceBetween' => (int) ($slide_option['spacebetween'] ?? 15),
'speed' => (int) ($slide_option['speed'] ?? 0),
'loop' => !$single_slide && !empty($slide_option['loop']),
'autoplay' => !$single_slide && !empty($slide_option['autoplay']),
'interval' => max(1, (int) ($slide_option['interval'] ?? 4)) * 1000,
'show_nav' => !empty($slide_option['button']),
'show_pagination' => !empty($slide_option['pagination']),
'wrapper_class' => 'mb20 single-cover-slide imgbox-container',
'slider_class' => 'single-cover single-cover--slide',
'overlay_html' => $overlay,
];
if (!empty($slide_option['scale_height'])) {
// 固定高度模式:PC/移动端分别取 px 高度。
$slider_args['scale_height'] = false;
$slider_args['pc_height'] = ((int) ($slide_option['pc_height'] ?? 380)) . 'px';
$slider_args['m_height'] = ((int) ($slide_option['m_height'] ?? 180)) . 'px';
} else {
// 比例高度模式:scale% + 50px(标题预留,与单图封面同公式)。
$slider_args['scale_height'] = true;
$slider_args['scale_ratio'] = max(10, (int) ($slide_option['scale'] ?? 35)) / 100;
$slider_args['scale_extra'] = '50px';
}
$slider_html = aksrt_render_slider($slider_args);
?>
empty($settings['hide_time']),
'meta_html' => (string) ($ctx['meta_box_html'] ?? ''),
]);
?>
$attrs Optional data-share-* overrides.
*/
function aksrt_render_share_dropdown(array $attrs = []): void {
static $printed = false;
if ($printed) {
return;
}
$printed = true;
$title = (string) ($attrs['title'] ?? get_the_title());
$url = (string) ($attrs['url'] ?? (get_permalink() ?: ''));
$image = (string) ($attrs['image'] ?? (get_the_post_thumbnail_url(null, 'large') ?: ''));
?>
0 && !empty($settings['rewards_enabled']) && function_exists('aksrt_get_rewards_button'))
? aksrt_get_rewards_button($reward_author, 'action action-rewards', $post_id)
: '';
if ($reward_btn !== '') {
echo $reward_btn; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
aksrt_render_rewards_modal_for_user($reward_author, $post_id);
}
?>
$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'];
?>
'article-yiyan yiyan-box aksrt-yiyan yiyan--footer',
]);
?>