refactor: 规范化 PHP 模板文件

- header.php: 修复箭头操作符空格, 移除多余空行 (1520 -> 1481 行)
- footer.php: 修复箭头操作符空格, 移除多余空行 (177 -> 168 行)
- sidebar.php: 修复箭头操作符空格, 移除多余空行 (1311 -> 1288 行)
- single.php: 修复箭头操作符空格, 移除多余空行 (214 -> 196 行)
- comments.php: 修复箭头操作符空格
- search.php: 修复箭头操作符空格
This commit is contained in:
2026-01-16 11:26:33 +08:00
parent 233edd2441
commit 733722e7d4
6 changed files with 66 additions and 157 deletions

View File

@@ -364,7 +364,7 @@ function resetGeetestCaptcha() {
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-user-circle"></i></span> <span class="input-group-text"><i class="fa fa-user-circle"></i></span>
</div> </div>
<input id="post_comment_name" class="form-control" placeholder="<?php _e('昵称', 'argon');?>" type="text" name="author" value="<?php if (is_user_logged_in()) {echo (wp_get_current_user() -> user_login);} else {echo htmlspecialchars($current_commenter['comment_author']);} ?>"> <input id="post_comment_name" class="form-control" placeholder="<?php _e('昵称', 'argon');?>" type="text" name="author" value="<?php if (is_user_logged_in()) {echo (wp_get_current_user()->user_login);} else {echo htmlspecialchars($current_commenter['comment_author']);} ?>">
</div> </div>
</div> </div>
</div> </div>
@@ -374,7 +374,7 @@ function resetGeetestCaptcha() {
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-envelope"></i></span> <span class="input-group-text"><i class="fa fa-envelope"></i></span>
</div> </div>
<input id="post_comment_email" class="form-control" placeholder="<?php _e('邮箱', 'argon');?><?php if ($enable_qq_avatar == 'true'){echo __(' / QQ 号', 'argon');} ?>" type="email" name="email" value="<?php if (is_user_logged_in()) {echo (wp_get_current_user() -> user_email);} else {echo htmlspecialchars($current_commenter['comment_author_email']);} ?>"> <input id="post_comment_email" class="form-control" placeholder="<?php _e('邮箱', 'argon');?><?php if ($enable_qq_avatar == 'true'){echo __(' / QQ 号', 'argon');} ?>" type="email" name="email" value="<?php if (is_user_logged_in()) {echo (wp_get_current_user()->user_email);} else {echo htmlspecialchars($current_commenter['comment_author_email']);} ?>">
</div> </div>
</div> </div>
</div> </div>
@@ -383,16 +383,14 @@ function resetGeetestCaptcha() {
<?php <?php
$captcha_type = get_option('argon_captcha_type', 'math'); $captcha_type = get_option('argon_captcha_type', 'math');
if ($captcha_type === 'geetest') { ?> if ($captcha_type === 'geetest') { ?>
<!-- Geetest 验证码容器 --> <!-- Geetest 验证码容器 --><div id="geetest-captcha" class="mb-4"></div>
<div id="geetest-captcha" class="mb-4"></div>
<input type="hidden" id="geetest_lot_number" name="lot_number" value=""> <input type="hidden" id="geetest_lot_number" name="lot_number" value="">
<input type="hidden" id="geetest_captcha_output" name="captcha_output" value=""> <input type="hidden" id="geetest_captcha_output" name="captcha_output" value="">
<input type="hidden" id="geetest_pass_token" name="pass_token" value=""> <input type="hidden" id="geetest_pass_token" name="pass_token" value="">
<input type="hidden" id="geetest_gen_time" name="gen_time" value=""> <input type="hidden" id="geetest_gen_time" name="gen_time" value="">
<input type="hidden" id="argon_comment_nonce" value="<?php echo wp_create_nonce('argon_comment'); ?>"> <input type="hidden" id="argon_comment_nonce" value="<?php echo wp_create_nonce('argon_comment'); ?>">
<?php } else { ?> <?php } else { ?>
<!-- 原有的数学验证码 --> <!-- 原有的数学验证码 --><div class="input-group input-group-alternative mb-4 post-comment-captcha-container" captcha="<?php echo get_comment_captcha(get_comment_captcha_seed());?>">
<div class="input-group input-group-alternative mb-4 post-comment-captcha-container" captcha="<?php echo get_comment_captcha(get_comment_captcha_seed());?>">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-key"></i></span> <span class="input-group-text"><i class="fa fa-key"></i></span>
</div> </div>

View File

@@ -29,8 +29,7 @@
</div> </div>
<!-- 加载主题核心 JS --> <!-- 加载主题核心 JS --><?php $assets_version = function_exists('argon_get_assets_version') ? argon_get_assets_version() : $GLOBALS['theme_version']; ?>
<?php $assets_version = function_exists('argon_get_assets_version') ? argon_get_assets_version() : $GLOBALS['theme_version']; ?>
<script src="<?php echo $GLOBALS['assets_path']; ?>/argontheme.js?v=<?php echo $assets_version; ?>"></script> <script src="<?php echo $GLOBALS['assets_path']; ?>/argontheme.js?v=<?php echo $assets_version; ?>"></script>
<?php if (get_option('argon_math_render') == 'mathjax3') { /*Mathjax V3*/?> <?php if (get_option('argon_math_render') == 'mathjax3') { /*Mathjax V3*/?>
@@ -149,17 +148,13 @@
<?php }?> <?php }?>
<?php if (get_option('argon_enable_code_highlight') == 'true') { /*Highlight.js*/?>
<?php if (get_option('argon_enable_code_highlight') == 'true') { /*Highlight.js*/?>
<link rel="stylesheet" href="<?php echo $GLOBALS['assets_path']; ?>/assets/vendor/highlight/styles/<?php echo get_option('argon_code_theme') == '' ? 'vs2015' : get_option('argon_code_theme'); ?>.css"> <link rel="stylesheet" href="<?php echo $GLOBALS['assets_path']; ?>/assets/vendor/highlight/styles/<?php echo get_option('argon_code_theme') == '' ? 'vs2015' : get_option('argon_code_theme'); ?>.css">
<?php }?> <?php }?>
</div>
</div>
</div> </div>
@@ -167,10 +162,6 @@
</body> </body>
<?php echo get_option('argon_custom_html_foot'); ?> <?php echo get_option('argon_custom_html_foot'); ?>
</html> </html>

View File

@@ -196,9 +196,7 @@
<?php } ?> <?php } ?>
<?php
<?php
$seo_keywords = get_seo_keywords(); $seo_keywords = get_seo_keywords();
@@ -208,9 +206,7 @@
<?php } ?> <?php } ?>
<?php
<?php
if (is_single() || is_page()){ if (is_single() || is_page()){
@@ -232,9 +228,7 @@
<?php } ?> <?php } ?>
<meta name="theme-color" content="<?php echo $themecolor; ?>">
<meta name="theme-color" content="<?php echo $themecolor; ?>">
<meta name="theme-color-rgb" content="<?php echo hex2str($themecolor); ?>"> <meta name="theme-color-rgb" content="<?php echo hex2str($themecolor); ?>">
@@ -242,21 +236,13 @@
<meta name="argon-enable-custom-theme-color" content="<?php echo (get_option('argon_show_customize_theme_color_picker') != 'false' ? 'true' : 'false'); ?>"> <meta name="argon-enable-custom-theme-color" content="<?php echo (get_option('argon_show_customize_theme_color_picker') != 'false' ? 'true' : 'false'); ?>">
<meta name="theme-card-radius" content="<?php echo $cardradius; ?>">
<meta name="theme-card-radius" content="<?php echo $cardradius; ?>">
<meta name="theme-card-radius-origin" content="<?php echo $cardradius_origin; ?>"> <meta name="theme-card-radius-origin" content="<?php echo $cardradius_origin; ?>">
<meta name="theme-version" content="<?php echo $GLOBALS['theme_version']; ?>">
<link rel="profile" href="http://gmpg.org/xfn/11">
<meta name="theme-version" content="<?php echo $GLOBALS['theme_version']; ?>">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?> <?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
@@ -293,8 +279,7 @@
<?php wp_head(); ?> <?php wp_head(); ?>
<?php if (function_exists('argon_is_force_refresh_enabled') && argon_is_force_refresh_enabled()): ?> <?php if (function_exists('argon_is_force_refresh_enabled') && argon_is_force_refresh_enabled()): ?>
<!-- 强制刷新缓存 - 清除浏览器和 Service Worker 缓存 --> <!-- 强制刷新缓存 - 清除浏览器和 Service Worker 缓存 --><script>
<script>
(function() { (function() {
var forceRefreshKey = 'argon_force_refresh_version'; var forceRefreshKey = 'argon_force_refresh_version';
var currentVersion = '<?php echo get_option('argon_force_refresh_enabled_time', 0); ?>'; var currentVersion = '<?php echo get_option('argon_force_refresh_enabled_time', 0); ?>';
@@ -337,8 +322,7 @@
</script> </script>
<?php endif; ?> <?php endif; ?>
<!-- 移动端资源加载修复 - 确保 CSS 完全应用 --> <!-- 移动端资源加载修复 - 确保 CSS 完全应用 --><script>
<script>
(function() { (function() {
// 检测移动端并强制重新计算样式 // 检测移动端并强制重新计算样式
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
@@ -370,8 +354,7 @@
window.argonUserRole = '<?php echo current_user_can('administrator') ? 'administrator' : (is_user_logged_in() ? 'user' : 'guest'); ?>'; window.argonUserRole = '<?php echo current_user_can('administrator') ? 'administrator' : (is_user_logged_in() ? 'user' : 'guest'); ?>';
</script> </script>
<!-- Argon 修复补丁 - 必须在 wp_head() 之后立即执行 --> <!-- Argon 修复补丁 - 必须在 wp_head() 之后立即执行 --><script src="<?php echo get_template_directory_uri(); ?>/assets/js/argon.min.js?ver=<?php echo $assets_version; ?>"></script>
<script src="<?php echo get_template_directory_uri(); ?>/assets/js/argon.min.js?ver=<?php echo $assets_version; ?>"></script>
<?php $GLOBALS['wp_path'] = get_option('argon_wp_path') == '' ? '/' : get_option('argon_wp_path'); ?> <?php $GLOBALS['wp_path'] = get_option('argon_wp_path') == '' ? '/' : get_option('argon_wp_path'); ?>
@@ -565,9 +548,7 @@
} }
function toggleAmoledDarkMode(){
function toggleAmoledDarkMode(){
document.documentElement.classList.toggle("amoled-dark"); document.documentElement.classList.toggle("amoled-dark");
@@ -605,9 +586,7 @@
</script> </script>
<?php if (get_option('argon_enable_smoothscroll_type') == '2') { /*平滑滚动*/?>
<?php if (get_option('argon_enable_smoothscroll_type') == '2') { /*平滑滚动*/?>
<script src="<?php echo $GLOBALS['assets_path']; ?>/assets/vendor/smoothscroll/smoothscroll2.js"></script> <script src="<?php echo $GLOBALS['assets_path']; ?>/assets/vendor/smoothscroll/smoothscroll2.js"></script>
@@ -627,12 +606,8 @@
</head> </head>
<?php echo get_option('argon_custom_html_head'); ?> <?php echo get_option('argon_custom_html_head'); ?>
<style id="themecolor_css"> <style id="themecolor_css">
<?php <?php
@@ -770,8 +745,6 @@ if ($animation_style == 'apple') {
<?php endif; ?> <?php endif; ?>
</style> </style>
<body <?php body_class(); ?>> <body <?php body_class(); ?>>
<?php /*wp_body_open();*/ ?> <?php /*wp_body_open();*/ ?>
@@ -882,17 +855,17 @@ if ($animation_style == 'apple') {
if ($depth == 0){ if ($depth == 0){
if ($args -> walker -> has_children == 1){ if ($args->walker->has_children == 1){
$output .= "\n $output .= "\n
<li class='nav-item dropdown'> <li class='nav-item dropdown'>
<a href='" . $object -> url . "' class='nav-link' data-toggle='dropdown' no-pjax onclick='return false;' title='" . $object -> description . "'> <a href='" . $object->url . "' class='nav-link' data-toggle='dropdown' no-pjax onclick='return false;' title='" . $object->description . "'>
<i class='ni ni-book-bookmark d-lg-none'></i> <i class='ni ni-book-bookmark d-lg-none'></i>
<span class='nav-link-inner--text'>" . $object -> title . "</span> <span class='nav-link-inner--text'>" . $object->title . "</span>
</a>"; </a>";
@@ -902,11 +875,11 @@ if ($animation_style == 'apple') {
<li class='nav-item'> <li class='nav-item'>
<a href='" . $object -> url . "' class='nav-link' target='" . $object -> target . "' title='" . $object -> description . "'> <a href='" . $object->url . "' class='nav-link' target='" . $object->target . "' title='" . $object->description . "'>
<i class='ni ni-book-bookmark d-lg-none'></i> <i class='ni ni-book-bookmark d-lg-none'></i>
<span class='nav-link-inner--text'>" . $object -> title . "</span> <span class='nav-link-inner--text'>" . $object->title . "</span>
</a>"; </a>";
@@ -914,7 +887,7 @@ if ($animation_style == 'apple') {
}else if ($depth == 1){ }else if ($depth == 1){
$output .= "<a href='" . $object -> url . "' class='dropdown-item' target='" . $object -> target . "' title='" . $object -> description . "'>" . $object -> title . "</a>"; $output .= "<a href='" . $object->url . "' class='dropdown-item' target='" . $object->target . "' title='" . $object->description . "'>" . $object->title . "</a>";
} }
@@ -1064,9 +1037,7 @@ if ($animation_style == 'apple') {
</div> </div>
<!--Banner--> <!--Banner--><section id="banner" class="banner section section-lg section-shaped">
<section id="banner" class="banner section section-lg section-shaped">
<div class="shape <?php echo get_option('argon_banner_background_hide_shapes') == 'true' ? '' : 'shape-style-1' ?> <?php echo get_option('argon_banner_background_color_type') == '' ? 'shape-primary' : get_option('argon_banner_background_color_type'); ?>"> <div class="shape <?php echo get_option('argon_banner_background_hide_shapes') == 'true' ? '' : 'shape-style-1' ?> <?php echo get_option('argon_banner_background_color_type') == '' ? 'shape-primary' : get_option('argon_banner_background_color_type'); ?>">
@@ -1090,9 +1061,7 @@ if ($animation_style == 'apple') {
</div> </div>
<?php
<?php
$banner_title = get_option('argon_banner_title') == '' ? get_bloginfo('name') : get_option('argon_banner_title'); $banner_title = get_option('argon_banner_title') == '' ? get_bloginfo('name') : get_option('argon_banner_title');
@@ -1144,8 +1113,6 @@ if ($animation_style == 'apple') {
</section> </section>
<?php if (apply_filters('argon_page_background_url', get_option('argon_page_background_url')) != '') { ?> <?php if (apply_filters('argon_page_background_url', get_option('argon_page_background_url')) != '') { ?>
<style> <style>
@@ -1286,8 +1253,7 @@ if ($animation_style == 'apple') {
<?php } ?> <?php } ?>
<!-- 毛玻璃效果 - 独立于背景图片设置(无背景图时也生效) --> <!-- 毛玻璃效果 - 独立于背景图片设置(无背景图时也生效) --><?php
<?php
$card_blur_standalone = intval(get_option('argon_card_blur', '20')); $card_blur_standalone = intval(get_option('argon_card_blur', '20'));
$card_saturate_standalone = intval(get_option('argon_card_saturate', '180')); $card_saturate_standalone = intval(get_option('argon_card_saturate', '180'));
$post_bg_opacity_standalone = get_option('argon_post_background_opacity', '0.7'); $post_bg_opacity_standalone = get_option('argon_post_background_opacity', '0.7');
@@ -1328,7 +1294,6 @@ if (apply_filters('argon_page_background_url', get_option('argon_page_background
</style> </style>
<?php endif; ?> <?php endif; ?>
<?php if (get_option('argon_show_toolbar_mask') == 'true') { ?> <?php if (get_option('argon_show_toolbar_mask') == 'true') { ?>
<style> <style>
@@ -1365,8 +1330,6 @@ if (apply_filters('argon_page_background_url', get_option('argon_page_background
<?php } ?> <?php } ?>
<div id="float_action_buttons" class="float-action-buttons fabtns-unloaded"> <div id="float_action_buttons" class="float-action-buttons fabtns-unloaded">
<button id="fabtn_toggle_sides" class="btn btn-icon btn-neutral fabtn shadow-sm" type="button" aria-hidden="true" tooltip-move-to-left="<?php _e('移至左侧', 'argon'); ?>" tooltip-move-to-right="<?php _e('移至右侧', 'argon'); ?>"> <button id="fabtn_toggle_sides" class="btn btn-icon btn-neutral fabtn shadow-sm" type="button" aria-hidden="true" tooltip-move-to-left="<?php _e('移至左侧', 'argon'); ?>" tooltip-move-to-right="<?php _e('移至右侧', 'argon'); ?>">
@@ -1513,7 +1476,5 @@ if (apply_filters('argon_page_background_url', get_option('argon_page_background
</div> </div>
<div id="content" class="site-content"> <div id="content" class="site-content">

View File

@@ -20,7 +20,7 @@
if ($filter_type[0] == '*'){ $filter_type = substr($filter_type, 1); } if ($filter_type[0] == '*'){ $filter_type = substr($filter_type, 1); }
$checked = in_array($filter_type, $current_filters_type); $checked = in_array($filter_type, $current_filters_type);
if (isset($all_post_types[$filter_type])){ if (isset($all_post_types[$filter_type])){
$filter_name = $all_post_types[$filter_type] -> labels -> name; $filter_name = $all_post_types[$filter_type]->labels->name;
?> ?>
<div class="custom-control custom-checkbox search-filter-wrapper"> <div class="custom-control custom-checkbox search-filter-wrapper">
<input class="custom-control-input search-filter" name="<?php echo $filter_type; ?>" id="search_filter_<?php echo $filter_type; ?>" type="checkbox" <?php echo $checked ? 'checked="true"' : ''; ?>> <input class="custom-control-input search-filter" name="<?php echo $filter_type; ?>" id="search_filter_<?php echo $filter_type; ?>" type="checkbox" <?php echo $checked ? 'checked="true"' : ''; ?>>
@@ -38,7 +38,7 @@
<?php } ?> <?php } ?>
<p class="text-black mt-3 mb-0 opacity-8"> <p class="text-black mt-3 mb-0 opacity-8">
<i class="fa fa-file-o mr-1"></i> <i class="fa fa-file-o mr-1"></i>
<?php global $wp_query; echo $wp_query -> found_posts; ?> <?php _e('个结果', 'argon');?> <?php global $wp_query; echo $wp_query->found_posts; ?> <?php _e('个结果', 'argon');?>
</p> </p>
</div> </div>
</div> </div>

View File

@@ -15,10 +15,8 @@ $author_desc = get_option('argon_sidebar_author_description');
<aside id="leftbar" class="<?php echo $leftbar_class; ?>" role="complementary"> <aside id="leftbar" class="<?php echo $leftbar_class; ?>" role="complementary">
<!-- 移动端侧边栏 - 重新设计的布局 --> <!-- 移动端侧边栏 - 重新设计的布局 --><div id="leftbar_mobile_nav" class="leftbar-mobile-nav">
<div id="leftbar_mobile_nav" class="leftbar-mobile-nav"> <!-- 顶部用户信息区 --><div class="leftbar-mobile-profile">
<!-- 顶部用户信息区 -->
<div class="leftbar-mobile-profile">
<div class="leftbar-mobile-close" id="leftbar_close_btn"> <div class="leftbar-mobile-close" id="leftbar_close_btn">
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
</div> </div>
@@ -48,8 +46,7 @@ $author_desc = get_option('argon_sidebar_author_description');
<div class="leftbar-mobile-user-desc"><?php echo esc_html($author_desc); ?></div> <div class="leftbar-mobile-user-desc"><?php echo esc_html($author_desc); ?></div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<!-- 统计数据 --> <!-- 统计数据 --><div class="leftbar-mobile-stats">
<div class="leftbar-mobile-stats">
<div class="leftbar-mobile-stat"> <div class="leftbar-mobile-stat">
<span class="stat-num"><?php echo wp_count_posts()->publish; ?></span> <span class="stat-num"><?php echo wp_count_posts()->publish; ?></span>
<span class="stat-label"><?php _e('文章', 'argon'); ?></span> <span class="stat-label"><?php _e('文章', 'argon'); ?></span>
@@ -65,16 +62,14 @@ $author_desc = get_option('argon_sidebar_author_description');
</div> </div>
</div> </div>
<!-- 搜索框 --> <!-- 搜索框 --><div class="leftbar-mobile-search">
<div class="leftbar-mobile-search">
<div class="leftbar-mobile-search-inner"> <div class="leftbar-mobile-search-inner">
<i class="fa fa-search"></i> <i class="fa fa-search"></i>
<input type="text" id="leftbar_mobile_search_input" placeholder="<?php _e('搜索...', 'argon'); ?>" autocomplete="off"> <input type="text" id="leftbar_mobile_search_input" placeholder="<?php _e('搜索...', 'argon'); ?>" autocomplete="off">
</div> </div>
</div> </div>
<!-- 导航菜单 --> <!-- 导航菜单 --><?php if ( has_nav_menu('toolbar_menu') ) : ?>
<?php if ( has_nav_menu('toolbar_menu') ) : ?>
<div class="leftbar-mobile-menu-section"> <div class="leftbar-mobile-menu-section">
<div class="leftbar-mobile-section-title"><?php _e('导航', 'argon'); ?></div> <div class="leftbar-mobile-section-title"><?php _e('导航', 'argon'); ?></div>
<ul class="leftbar-mobile-menu"> <ul class="leftbar-mobile-menu">
@@ -117,8 +112,7 @@ $author_desc = get_option('argon_sidebar_author_description');
</div> </div>
<?php endif; ?> <?php endif; ?>
<!-- 侧边栏菜单 --> <!-- 侧边栏菜单 --><?php if ( has_nav_menu('leftbar_menu') ) : ?>
<?php if ( has_nav_menu('leftbar_menu') ) : ?>
<div class="leftbar-mobile-menu-section"> <div class="leftbar-mobile-menu-section">
<div class="leftbar-mobile-section-title"><?php _e('更多', 'argon'); ?></div> <div class="leftbar-mobile-section-title"><?php _e('更多', 'argon'); ?></div>
<ul class="leftbar-mobile-menu"> <ul class="leftbar-mobile-menu">
@@ -135,8 +129,7 @@ $author_desc = get_option('argon_sidebar_author_description');
</div> </div>
<?php endif; ?> <?php endif; ?>
<!-- 文章目录折叠面板 (仅在文章页显示) --> <!-- 文章目录折叠面板 (仅在文章页显示) --><?php if (have_catalog()) : ?>
<?php if (have_catalog()) : ?>
<div class="leftbar-mobile-collapse-section"> <div class="leftbar-mobile-collapse-section">
<div class="leftbar-mobile-collapse-header" id="mobile_catalog_toggle"> <div class="leftbar-mobile-collapse-header" id="mobile_catalog_toggle">
<div class="collapse-header-left"> <div class="collapse-header-left">
@@ -151,8 +144,7 @@ $author_desc = get_option('argon_sidebar_author_description');
</div> </div>
<?php endif; ?> <?php endif; ?>
<!-- TODO折叠面板 --> <!-- TODO折叠面板 --><?php if (get_option('argon_show_todo_list', 'true') == 'true') : ?>
<?php if (get_option('argon_show_todo_list', 'true') == 'true') : ?>
<?php <?php
$mobile_todos = argon_get_todo_list(); $mobile_todos = argon_get_todo_list();
$mobile_is_author = current_user_can('publish_posts'); $mobile_is_author = current_user_can('publish_posts');
@@ -259,8 +251,7 @@ $author_desc = get_option('argon_sidebar_author_description');
</script> </script>
<?php endif; ?> <?php endif; ?>
<!-- 顶栏自定义链接 --> <!-- 顶栏自定义链接 --><?php
<?php
$toolbar_links_left = get_option('argon_toolbar_links_left', ''); $toolbar_links_left = get_option('argon_toolbar_links_left', '');
$toolbar_links_right = get_option('argon_toolbar_links_right', ''); $toolbar_links_right = get_option('argon_toolbar_links_right', '');
$has_custom_links = !empty(trim($toolbar_links_left)) || !empty(trim($toolbar_links_right)); $has_custom_links = !empty(trim($toolbar_links_left)) || !empty(trim($toolbar_links_right));
@@ -307,8 +298,7 @@ $author_desc = get_option('argon_sidebar_author_description');
</div> </div>
<?php endif; ?> <?php endif; ?>
<!-- 底部操作区 --> <!-- 底部操作区 --><div class="leftbar-mobile-footer">
<div class="leftbar-mobile-footer">
<div class="leftbar-mobile-actions"> <div class="leftbar-mobile-actions">
<button class="leftbar-mobile-action" onclick="toggleDarkmode()"> <button class="leftbar-mobile-action" onclick="toggleDarkmode()">
<i class="fa fa-moon-o"></i> <i class="fa fa-moon-o"></i>
@@ -326,8 +316,7 @@ $author_desc = get_option('argon_sidebar_author_description');
</div> </div>
</div> </div>
<!-- 桌面端原有侧边栏内容 --> <!-- 桌面端原有侧边栏内容 --><div class="leftbar-desktop-content">
<div class="leftbar-desktop-content">
<?php if (get_option('argon_sidebar_announcement') != '') { ?> <?php if (get_option('argon_sidebar_announcement') != '') { ?>
<div id="leftbar_announcement" class="card bg-white shadow-sm border-0"> <div id="leftbar_announcement" class="card bg-white shadow-sm border-0">
@@ -350,9 +339,7 @@ $author_desc = get_option('argon_sidebar_author_description');
<span class="leftbar-banner-title text-white"><?php echo get_option('argon_sidebar_banner_title') == '' ? bloginfo('name') : get_option('argon_sidebar_banner_title'); ?></span> <span class="leftbar-banner-title text-white"><?php echo get_option('argon_sidebar_banner_title') == '' ? bloginfo('name') : get_option('argon_sidebar_banner_title'); ?></span>
<?php
<?php
$sidebar_subtitle = get_option('argon_sidebar_banner_subtitle'); $sidebar_subtitle = get_option('argon_sidebar_banner_subtitle');
@@ -370,13 +357,9 @@ $author_desc = get_option('argon_sidebar_author_description');
<?php } /*顶栏标题*/?> <?php } /*顶栏标题*/?>
</div>
<?php
</div>
<?php
/*侧栏上部菜单*/ /*侧栏上部菜单*/
@@ -402,9 +385,9 @@ $author_desc = get_option('argon_sidebar_author_description');
$output .= "\n $output .= "\n
<li class='leftbar-menu-item" . ( $args -> walker -> has_children == 1 ? " leftbar-menu-item-haschildren" : "" ) . ( $object -> current == 1 ? " current" : "" ) . "'> <li class='leftbar-menu-item" . ( $args->walker->has_children == 1 ? " leftbar-menu-item-haschildren" : "" ) . ( $object->current == 1 ? " current" : "" ) . "'>
<a href='" . $object -> url . "'" . ( $args -> walker -> has_children == 1 ? " no-pjax onclick='return false;'" : "" ) . " target='" . $object -> target . "'>". $object -> title . "</a>"; <a href='" . $object->url . "'" . ( $args->walker->has_children == 1 ? " no-pjax onclick='return false;'" : "" ) . " target='" . $object->target . "'>". $object->title . "</a>";
} }
@@ -595,7 +578,7 @@ $author_desc = get_option('argon_sidebar_author_description');
<a <?php $archives_page_url = get_option('argon_archives_timeline_url'); echo (empty($archives_page_url) ? ' style="cursor: default;"' : 'href="' . $archives_page_url . '"');?>> <a <?php $archives_page_url = get_option('argon_archives_timeline_url'); echo (empty($archives_page_url) ? ' style="cursor: default;"' : 'href="' . $archives_page_url . '"');?>>
<span class="site-state-item-count"><?php echo wp_count_posts() -> publish; ?></span> <span class="site-state-item-count"><?php echo wp_count_posts()->publish; ?></span>
<span class="site-state-item-name"><?php _e('文章', 'argon');?></span> <span class="site-state-item-name"><?php _e('文章', 'argon');?></span>
@@ -643,7 +626,7 @@ $author_desc = get_option('argon_sidebar_author_description');
<div class='site-author-links-item'> <div class='site-author-links-item'>
<a href='" . $object -> url . "' rel='noopener' target='_blank'>". $object -> title . "</a>"; <a href='" . $object->url . "' rel='noopener' target='_blank'>". $object->title . "</a>";
} }
@@ -661,9 +644,7 @@ $author_desc = get_option('argon_sidebar_author_description');
} }
if ( has_nav_menu('leftbar_author_links') ){
if ( has_nav_menu('leftbar_author_links') ){
echo "<div class='site-author-links'>"; echo "<div class='site-author-links'>";
@@ -701,7 +682,7 @@ $author_desc = get_option('argon_sidebar_author_description');
<li class='site-friend-links-item'> <li class='site-friend-links-item'>
<a href='" . $object -> url . "' rel='noopener' target='_blank'>". $object -> title . "</a>"; <a href='" . $object->url . "' rel='noopener' target='_blank'>". $object->title . "</a>";
} }
@@ -719,9 +700,7 @@ $author_desc = get_option('argon_sidebar_author_description');
} }
if ( has_nav_menu('leftbar_friend_links') ){
if ( has_nav_menu('leftbar_friend_links') ){
echo "<div class='site-friend-links'> echo "<div class='site-friend-links'>
@@ -1178,9 +1157,7 @@ $author_desc = get_option('argon_sidebar_author_description');
</script> </script>
<?php endif; ?> <?php endif; ?>
</div><!-- .leftbar-desktop-content --> </div><!-- .leftbar-desktop-content --></aside>
</aside>
<div class="modal fade" id="blog_categories" tabindex="-1" role="dialog" aria-labelledby="" aria-hidden="true"> <div class="modal fade" id="blog_categories" tabindex="-1" role="dialog" aria-labelledby="" aria-hidden="true">
@@ -1224,7 +1201,7 @@ $author_desc = get_option('argon_sidebar_author_description');
foreach($categories as $category) { foreach($categories as $category) {
echo "<a href=" . get_category_link( $category -> term_id ) . " class='badge badge-secondary tag'>" . $category->name . " <span class='tag-num'>" . $category -> count . "</span></a>"; echo "<a href=" . get_category_link( $category->term_id ) . " class='badge badge-secondary tag'>" . $category->name . " <span class='tag-num'>" . $category->count . "</span></a>";
} }
@@ -1280,7 +1257,7 @@ $author_desc = get_option('argon_sidebar_author_description');
foreach($categories as $category) { foreach($categories as $category) {
echo "<a href=" . get_category_link( $category -> term_id ) . " class='badge badge-secondary tag'>" . $category->name . " <span class='tag-num'>" . $category -> count . "</span></a>"; echo "<a href=" . get_category_link( $category->term_id ) . " class='badge badge-secondary tag'>" . $category->name . " <span class='tag-num'>" . $category->count . "</span></a>";
} }

View File

@@ -1,15 +1,9 @@
<?php get_header(); ?> <?php get_header(); ?>
<div class="page-information-card-container"></div> <div class="page-information-card-container"></div>
<?php get_sidebar(); ?> <?php get_sidebar(); ?>
<div id="primary" class="content-area"> <div id="primary" class="content-area">
<main id="main" class="site-main" role="main"> <main id="main" class="site-main" role="main">
@@ -20,22 +14,16 @@
the_post(); the_post();
get_template_part( 'template-parts/content', 'single' );
// 文章操作按钮(分享和评论)
get_template_part( 'template-parts/content', 'single' );
// 文章操作按钮(分享和评论)
get_template_part( 'template-parts/post-actions' ); get_template_part( 'template-parts/post-actions' );
if (comments_open() || get_comments_number()) { if (comments_open() || get_comments_number()) {
comments_template(); comments_template();
} }
if ( is_singular( 'post' ) ) {
if ( is_singular( 'post' ) ) {
if (get_previous_post() || get_next_post()){ if (get_previous_post() || get_next_post()){
@@ -67,9 +55,7 @@
} }
$relatedPosts = get_option('argon_related_post', 'disabled');
$relatedPosts = get_option('argon_related_post', 'disabled');
if ($relatedPosts != "disabled"){ if ($relatedPosts != "disabled"){
@@ -79,13 +65,13 @@
if (strpos($relatedPosts, 'category') !== false){ if (strpos($relatedPosts, 'category') !== false){
$cats = get_the_category($post -> ID); $cats = get_the_category($post->ID);
if ($cats){ if ($cats){
foreach($cats as $key1 => $cat) { foreach($cats as $key1 => $cat) {
$cat_array[$key1] = $cat -> slug; $cat_array[$key1] = $cat->slug;
} }
@@ -97,13 +83,13 @@
if (strpos($relatedPosts, 'tag') !== false){ if (strpos($relatedPosts, 'tag') !== false){
$tags = get_the_tags($post -> ID); $tags = get_the_tags($post->ID);
if ($tags){ if ($tags){
foreach($tags as $key2 => $tag) { foreach($tags as $key2 => $tag) {
$tag_array[$key2] = $tag -> slug; $tag_array[$key2] = $tag->slug;
} }
@@ -121,7 +107,7 @@
'meta_key' => 'views', 'meta_key' => 'views',
'post__not_in' => array($post -> ID), 'post__not_in' => array($post->ID),
'tax_query' => array( 'tax_query' => array(
@@ -153,7 +139,7 @@
)); ));
if ($query -> have_posts()) { if ($query->have_posts()) {
echo '<div class="related-posts card shadow-sm"> echo '<div class="related-posts card shadow-sm">
@@ -167,9 +153,9 @@
<div style="overflow-x: auto;padding: 1.5rem;padding-top: 0.8rem;padding-bottom: 0.8rem;}">'; <div style="overflow-x: auto;padding: 1.5rem;padding-top: 0.8rem;padding-bottom: 0.8rem;}">';
while ($query -> have_posts()) { while ($query->have_posts()) {
$query -> the_post(); $query->the_post();
$hasThumbnail = argon_has_post_thumbnail(get_the_ID()); $hasThumbnail = argon_has_post_thumbnail(get_the_ID());
@@ -201,13 +187,9 @@
} }
endwhile;
endwhile;
?> ?>
<?php get_footer(); ?> <?php get_footer(); ?>