archives/friends/newposts/posts-navs/categories 统一壳层与 page-header 契约, 主路径不再保留 aksrt_ph_* ambient 传参。
67 lines
2.4 KiB
PHP
67 lines
2.4 KiB
PHP
<?php
|
|
/**
|
|
* Template Name: 友情链接
|
|
* Template Post Type: page
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
get_header();
|
|
|
|
$links = function_exists('aksrt_get_friend_links') ? aksrt_get_friend_links() : [];
|
|
|
|
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' => 'friends',
|
|
]);
|
|
}
|
|
?>
|
|
<div class="content-main content-main--page content-main--friends">
|
|
<?php
|
|
get_template_part('templates/parts/page-header', null, [
|
|
'title' => esc_html__('友情链接', 'aksrt'),
|
|
'desc' => __('与这些优秀的站点交换友链', 'aksrt'),
|
|
]);
|
|
?>
|
|
|
|
<?php if (!empty($links)) : ?>
|
|
<div class="friends-grid">
|
|
<?php foreach ($links as $link) : ?>
|
|
<a class="friend-card" href="<?php echo esc_url($link['url'] ?? '#'); ?>" target="_blank" rel="noopener noreferrer">
|
|
<?php
|
|
$logo = $link['logo'] ?? '';
|
|
if ($logo) {
|
|
echo '<img class="friend-card__avatar" src="' . esc_url($logo) . '" alt="">';
|
|
} else {
|
|
$initial = function_exists('mb_substr') ? mb_substr((string) ($link['name'] ?? 'A'), 0, 1, 'UTF-8') : substr((string) ($link['name'] ?? 'A'), 0, 1);
|
|
echo '<div class="friend-card__avatar" style="display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--color-primary);font-family:var(--font-heading);">' . esc_html($initial) . '</div>';
|
|
}
|
|
?>
|
|
<div class="friend-card__info">
|
|
<h3 class="friend-card__name"><?php echo esc_html($link['name'] ?? ''); ?></h3>
|
|
<p class="friend-card__desc"><?php echo esc_html($link['description'] ?? ''); ?></p>
|
|
</div>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php else : ?>
|
|
<div class="no-results content-stream__empty">
|
|
<p><?php esc_html_e('暂无友链,请在主题后台添加。', 'aksrt'); ?></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<p class="text-center" style="margin-top:32px;">
|
|
<a class="btn-outline" href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('返回首页', 'aksrt'); ?></a>
|
|
</p>
|
|
</div>
|
|
<?php
|
|
if (function_exists('aksrt_archive_close_shell')) {
|
|
aksrt_archive_close_shell(['has_sidebar' => false]);
|
|
}
|
|
|
|
get_footer();
|