Files
wordpress-theme-aksrt/index.php
T

54 lines
1.4 KiB
PHP

<?php
/**
* Main posts index template.
*
* v4 起主题统一为 CMS / 资源站形态:
* - 首页第一页固定走 AKSRT_Home_Modules 模块系统
* - 其它情况(分页 / 没有 home modules class 时的兜底)走标准列表
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
if (function_exists('aksrt_render_fixed_homepage') && aksrt_render_fixed_homepage()) {
return;
}
get_header();
// 兜底:模块系统未就绪 或 已分页 → 标准列表
?>
<main id="main-content" class="site-main container" tabindex="-1">
<?php $has_sidebar = is_active_sidebar('sidebar-blog'); ?>
<div class="content-wrap">
<div class="content-layout<?php echo $has_sidebar ? '' : ' content-layout--no-sidebar'; ?>">
<div class="content-layout__primary">
<?php
$post_layout = class_exists('AKSRT_Settings')
? AKSRT_Settings::get_archive_layout()
: 'grid-cms';
$render_mode = in_array($post_layout, ['list', 'mini'], true) ? $post_layout : 'card';
?>
<?php if (have_posts()) : ?>
<?php aksrt_render_post_list(null, ['context' => 'archive', 'mode' => $render_mode, 'card_style' => 'standard']); ?>
<?php aksrt_render_pagination(); ?>
<?php else : ?>
<div class="no-results">
<p><?php esc_html_e('暂无文章。', 'aksrt'); ?></p>
</div>
<?php endif; ?>
</div>
<?php if ($has_sidebar) : ?>
<?php get_sidebar(); ?>
<?php endif; ?>
</div>
</div>
</main>
<?php
get_footer();