fix: 修复移动端目录和顶栏链接显示问题
- 移动端抽屉栏新增顶栏自定义链接显示(argon_toolbar_links_left/right) - 优化 have_catalog() 函数,增加对 Gutenberg 标题块和 Markdown 标题的检测 - 自定义链接显示在导航菜单和侧边栏菜单之间
This commit is contained in:
48
sidebar.php
48
sidebar.php
@@ -117,6 +117,54 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 顶栏自定义链接 -->
|
||||
<?php
|
||||
$toolbar_links_left = get_option('argon_toolbar_links_left', '');
|
||||
$toolbar_links_right = get_option('argon_toolbar_links_right', '');
|
||||
$has_custom_links = !empty(trim($toolbar_links_left)) || !empty(trim($toolbar_links_right));
|
||||
if ($has_custom_links) :
|
||||
?>
|
||||
<div class="leftbar-mobile-menu-section">
|
||||
<div class="leftbar-mobile-section-title"><?php _e('链接', 'argon'); ?></div>
|
||||
<ul class="leftbar-mobile-menu">
|
||||
<?php
|
||||
// 输出左侧自定义链接
|
||||
if (!empty(trim($toolbar_links_left))) {
|
||||
foreach (explode("\n", $toolbar_links_left) as $line) {
|
||||
$line = trim($line);
|
||||
if (empty($line)) continue;
|
||||
$parts = array_map('trim', explode('|', $line));
|
||||
if (!empty($parts[0])) {
|
||||
$url = isset($parts[1]) ? $parts[1] : '#';
|
||||
$icon = isset($parts[2]) ? '<i class="' . esc_attr($parts[2]) . '"></i> ' : '';
|
||||
echo '<li class="leftbar-mobile-menu-item">';
|
||||
echo '<a href="' . esc_url($url) . '">';
|
||||
echo $icon . '<span class="menu-text">' . esc_html($parts[0]) . '</span>';
|
||||
echo '</a></li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// 输出右侧自定义链接
|
||||
if (!empty(trim($toolbar_links_right))) {
|
||||
foreach (explode("\n", $toolbar_links_right) as $line) {
|
||||
$line = trim($line);
|
||||
if (empty($line)) continue;
|
||||
$parts = array_map('trim', explode('|', $line));
|
||||
if (!empty($parts[0])) {
|
||||
$url = isset($parts[1]) ? $parts[1] : '#';
|
||||
$icon = isset($parts[2]) ? '<i class="' . esc_attr($parts[2]) . '"></i> ' : '';
|
||||
echo '<li class="leftbar-mobile-menu-item">';
|
||||
echo '<a href="' . esc_url($url) . '">';
|
||||
echo $icon . '<span class="menu-text">' . esc_html($parts[0]) . '</span>';
|
||||
echo '</a></li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 侧边栏菜单 -->
|
||||
<?php if ( has_nav_menu('leftbar_menu') ) : ?>
|
||||
<div class="leftbar-mobile-menu-section">
|
||||
|
||||
Reference in New Issue
Block a user