112 lines
3.7 KiB
PHP
112 lines
3.7 KiB
PHP
<?php
|
|
/**
|
|
* 固定页面模板
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
get_header();
|
|
|
|
$page_settings = class_exists('\AKSRT\Settings\Settings')
|
|
? \AKSRT\Settings\Settings::get_post_page_settings()
|
|
: ['reading_progress' => false, 'lightbox' => true];
|
|
$page_id = get_queried_object_id();
|
|
$page_content_style = get_post_meta($page_id, 'page_content_style', true);
|
|
$page_content_style = $page_content_style !== '' ? sanitize_html_class($page_content_style) : 'default';
|
|
$show_sidebar = function_exists('aksrt_is_show_sidebar') ? aksrt_is_show_sidebar() : true;
|
|
?>
|
|
|
|
<?php if (!empty($page_settings['reading_progress'])) : ?>
|
|
<div id="reading-progress-global" class="reading-progress-bar" role="progressbar" aria-label="<?php esc_attr_e('阅读进度', 'aksrt'); ?>" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"></div>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
// legacy page.php: fluid top OUTSIDE main; main.container + content-wrap/layout + sidebar sibling.
|
|
// Do not put content-shell padding/max-width on the dual-column host (breaks float math).
|
|
?>
|
|
<?php if (is_active_sidebar('page_top_fluid_' . $page_id)) : ?>
|
|
<div class="fluid-widget-wrap">
|
|
<?php dynamic_sidebar('page_top_fluid_' . $page_id); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<main id="main-content" class="site-main container page-content-<?php echo esc_attr($page_content_style); ?> page-id-<?php echo esc_attr((string) $page_id); ?>" tabindex="-1">
|
|
<div class="content-wrap">
|
|
<div class="content-layout">
|
|
<?php if (is_active_sidebar('page_top_content_' . $page_id)) : ?>
|
|
<?php dynamic_sidebar('page_top_content_' . $page_id); ?>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
while (have_posts()) :
|
|
the_post();
|
|
|
|
$page_meta_header_style = get_post_meta(get_the_ID(), 'page_header_style', true);
|
|
$ph_style_override = null;
|
|
if ($page_meta_header_style !== '' && in_array($page_meta_header_style, ['', '1', '2', '3', 'not'], true)) {
|
|
$ph_style_override = ($page_meta_header_style === 'not') ? '' : $page_meta_header_style;
|
|
}
|
|
$page_cover = (string) get_post_meta(get_the_ID(), 'page_header_cover_img', true);
|
|
$header_args = [
|
|
'title' => get_the_title(),
|
|
];
|
|
if ($ph_style_override !== null) {
|
|
$header_args['style'] = $ph_style_override;
|
|
}
|
|
if ($page_cover !== '') {
|
|
$header_args['cover'] = esc_url($page_cover);
|
|
}
|
|
?>
|
|
<article <?php post_class('entry-page'); ?>>
|
|
<?php get_template_part('templates/parts/page-header', null, $header_args); ?>
|
|
|
|
<?php if (has_post_thumbnail()) : ?>
|
|
<figure class="entry-thumb" data-aksrt-lightbox="<?php echo !empty($page_settings['lightbox']) ? '1' : '0'; ?>">
|
|
|
|
<?php the_post_thumbnail('large'); ?>
|
|
</figure>
|
|
<?php endif; ?>
|
|
|
|
<div class="entry-content" data-aksrt-lightbox="<?php echo !empty($page_settings['lightbox']) ? '1' : '0'; ?>">
|
|
<?php the_content(); ?>
|
|
<?php
|
|
wp_link_pages([
|
|
'before' => '<nav class="page-links"><span class="page-links-title">' . esc_html__('分页:', 'aksrt') . '</span>',
|
|
'after' => '</nav>',
|
|
]);
|
|
?>
|
|
</div>
|
|
</article>
|
|
|
|
<?php
|
|
// 评论关闭时模板整体不渲染(legacy 行为),无需空卡片。
|
|
if (comments_open()) {
|
|
echo '<div class="theme-box box-body radius8 main-shadow comments-card">';
|
|
comments_template();
|
|
echo '</div>';
|
|
}
|
|
|
|
endwhile;
|
|
?>
|
|
|
|
<?php if (is_active_sidebar('page_bottom_content_' . $page_id)) : ?>
|
|
<?php dynamic_sidebar('page_bottom_content_' . $page_id); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php if ($show_sidebar) : ?>
|
|
<?php get_sidebar(); ?>
|
|
<?php endif; ?>
|
|
</main>
|
|
|
|
<?php if (is_active_sidebar('page_bottom_fluid_' . $page_id)) : ?>
|
|
<div class="fluid-widget-wrap">
|
|
<?php dynamic_sidebar('page_bottom_fluid_' . $page_id); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
get_footer();
|