archives/friends/newposts/posts-navs/categories 统一壳层与 page-header 契约, 主路径不再保留 aksrt_ph_* ambient 传参。
66 lines
2.3 KiB
PHP
66 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* Template Name: AKSRT - Posts Navigation
|
|
* Template Post Type: page
|
|
*
|
|
* 文章导航页:分类+标签的导航聚合页。
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
get_header();
|
|
|
|
$categories = get_categories(['hide_empty' => true, 'orderby' => 'count', 'order' => 'DESC', 'number' => 20]);
|
|
$tags = get_tags(['hide_empty' => true, 'orderby' => 'count', 'order' => 'DESC', 'number' => 40]);
|
|
|
|
if (function_exists('aksrt_archive_open_shell')) {
|
|
aksrt_archive_open_shell([
|
|
'main_class' => 'site-main container content-shell content-shell--page page-content-default',
|
|
'has_sidebar' => false,
|
|
'page_kind' => 'posts-navs',
|
|
]);
|
|
}
|
|
?>
|
|
<div class="content-main content-main--page content-main--posts-navs">
|
|
<?php
|
|
get_template_part('templates/parts/page-header', null, [
|
|
'title' => esc_html(get_the_title() ?: __('文章导航', 'aksrt')),
|
|
]);
|
|
?>
|
|
|
|
<div class="aksrt-posts-navs">
|
|
<?php if (!empty($categories)) : ?>
|
|
<section class="aksrt-posts-navs__section">
|
|
<h2 class="aksrt-posts-navs__heading"><?php esc_html_e('热门分类', 'aksrt'); ?></h2>
|
|
<div class="aksrt-posts-navs__cats">
|
|
<?php foreach ($categories as $cat) : ?>
|
|
<a href="<?php echo esc_url(get_category_link($cat->term_id)); ?>" class="aksrt-posts-navs__cat-chip">
|
|
<span class="aksrt-posts-navs__cat-name"><?php echo esc_html($cat->name); ?></span>
|
|
<span class="aksrt-posts-navs__cat-count"><?php echo esc_html((string) $cat->count); ?></span>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</section>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($tags)) : ?>
|
|
<section class="aksrt-posts-navs__section">
|
|
<h2 class="aksrt-posts-navs__heading"><?php esc_html_e('热门标签', 'aksrt'); ?></h2>
|
|
<div class="aksrt-posts-navs__tags">
|
|
<?php foreach ($tags as $tag) : ?>
|
|
<a href="<?php echo esc_url(get_tag_link($tag->term_id)); ?>" class="aksrt-posts-navs__tag"><?php echo esc_html($tag->name); ?></a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</section>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
if (function_exists('aksrt_archive_close_shell')) {
|
|
aksrt_archive_close_shell(['has_sidebar' => false]);
|
|
}
|
|
|
|
get_footer();
|