Wire settings-driven sidebar visibility and body site-layout classes, replace content-layout CSS grid with Zibll float geometry, move sidebar DOM to content-wrap sibling across single/archive/page/home, and add post meta show_layout overrides.
120 lines
4.1 KiB
PHP
120 lines
4.1 KiB
PHP
<?php
|
|
/**
|
|
* 固定页面模板
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
get_header();
|
|
|
|
$page_settings = class_exists('AKSRT_Settings')
|
|
? AKSRT_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; ?>
|
|
|
|
<main id="main-content" class="site-main container content-shell content-shell--page page-content-<?php echo esc_attr($page_content_style); ?> page-id-<?php echo esc_attr((string) $page_id); ?>" tabindex="-1">
|
|
|
|
<?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; ?>
|
|
|
|
<div class="content-wrap">
|
|
<div class="content-layout<?php echo $show_sidebar ? '' : ' content-layout--no-sidebar'; ?>">
|
|
<div class="content-layout__primary">
|
|
<?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">
|
|
<?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
|
|
if (comments_open() || get_comments_number()) {
|
|
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>
|
|
</div>
|
|
|
|
<?php if ($show_sidebar) : ?>
|
|
<?php get_sidebar(); ?>
|
|
<?php endif; ?>
|
|
|
|
<?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; ?>
|
|
</main>
|
|
|
|
<?php if (!empty($page_settings['lightbox'])) : ?>
|
|
<div class="lightbox-overlay" id="lightbox-overlay" role="dialog" aria-modal="true" aria-label="<?php esc_attr_e('图片预览', 'aksrt'); ?>">
|
|
<button type="button" class="lightbox-close" aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fas fa-times"></i></button>
|
|
<img src="" alt="" class="lightbox-img">
|
|
<div class="lightbox-caption" aria-live="polite"></div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="toast-container" id="toast-container"></div>
|
|
|
|
<?php
|
|
get_footer();
|