fix: 修复代码错误和优化重复调用
- 修复 argon_get_locate() 函数缺失返回语句的问题 - 优化 content-single.php 中重复的 get_option 调用(4次→1次) - 优化 content-page.php 中重复的 get_option 调用(4次→1次) - 优化 content-timeline.php 中重复的 get_option 调用(4次→1次) - 优化 post-actions.php 中重复的 get_option 调用(4次→1次)
This commit is contained in:
@@ -161,6 +161,7 @@ function argon_get_locate(){
|
|||||||
if (is_admin()){
|
if (is_admin()){
|
||||||
$determined_locale = get_user_locale();
|
$determined_locale = get_user_locale();
|
||||||
}
|
}
|
||||||
|
return argon_locate_filter($determined_locale);
|
||||||
}
|
}
|
||||||
function theme_locale_hook($locate, $domain){
|
function theme_locale_hook($locate, $domain){
|
||||||
if ($domain == 'argon'){
|
if ($domain == 'argon'){
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<article class="post post-full card bg-white shadow-sm border-0" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<article class="post post-full card bg-white shadow-sm border-0" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<header class="post-header text-center<?php if (argon_has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') != 'true'){echo " post-header-with-thumbnail";}?>">
|
<?php $show_thumbnail_in_banner = get_option('argon_show_thumbnail_in_banner_in_content_page', 'false'); ?>
|
||||||
|
<header class="post-header text-center<?php if (argon_has_post_thumbnail() && $show_thumbnail_in_banner != 'true'){echo " post-header-with-thumbnail";}?>">
|
||||||
<?php
|
<?php
|
||||||
if (argon_has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') != 'true'){
|
if (argon_has_post_thumbnail() && $show_thumbnail_in_banner != 'true'){
|
||||||
$thumbnail_url = argon_get_post_thumbnail();
|
$thumbnail_url = argon_get_post_thumbnail();
|
||||||
echo "<img class='post-thumbnail' src='" . $thumbnail_url . "'></img>";
|
echo "<img class='post-thumbnail' src='" . $thumbnail_url . "'></img>";
|
||||||
echo "<div class='post-header-text-container'>";
|
echo "<div class='post-header-text-container'>";
|
||||||
}
|
}
|
||||||
if (argon_has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') == 'true'){
|
if (argon_has_post_thumbnail() && $show_thumbnail_in_banner == 'true'){
|
||||||
$thumbnail_url = argon_get_post_thumbnail();
|
$thumbnail_url = argon_get_post_thumbnail();
|
||||||
echo "
|
echo "
|
||||||
<style>
|
<style>
|
||||||
@@ -47,7 +48,7 @@
|
|||||||
} ?>
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if (has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') != 'true'){
|
if (has_post_thumbnail() && $show_thumbnail_in_banner != 'true'){
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<article class="post post-full card bg-white shadow-sm border-0" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<article class="post post-full card bg-white shadow-sm border-0" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<header class="post-header text-center<?php if (argon_has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') != 'true'){echo " post-header-with-thumbnail";}?>">
|
<?php $show_thumbnail_in_banner = get_option('argon_show_thumbnail_in_banner_in_content_page', 'false'); ?>
|
||||||
|
<header class="post-header text-center<?php if (argon_has_post_thumbnail() && $show_thumbnail_in_banner != 'true'){echo " post-header-with-thumbnail";}?>">
|
||||||
<?php
|
<?php
|
||||||
if (argon_has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') != 'true'){
|
if (argon_has_post_thumbnail() && $show_thumbnail_in_banner != 'true'){
|
||||||
$thumbnail_url = argon_get_post_thumbnail();
|
$thumbnail_url = argon_get_post_thumbnail();
|
||||||
echo "<img class='post-thumbnail' src='" . $thumbnail_url . "'></img>";
|
echo "<img class='post-thumbnail' src='" . $thumbnail_url . "'></img>";
|
||||||
echo "<div class='post-header-text-container'>";
|
echo "<div class='post-header-text-container'>";
|
||||||
}
|
}
|
||||||
if (argon_has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') == 'true'){
|
if (argon_has_post_thumbnail() && $show_thumbnail_in_banner == 'true'){
|
||||||
$thumbnail_url = argon_get_post_thumbnail();
|
$thumbnail_url = argon_get_post_thumbnail();
|
||||||
echo "
|
echo "
|
||||||
<style>
|
<style>
|
||||||
@@ -44,7 +45,7 @@
|
|||||||
} ?>
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if (has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') != 'true'){
|
if (has_post_thumbnail() && $show_thumbnail_in_banner != 'true'){
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<article class="post post-full card bg-white shadow-sm border-0" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<article class="post post-full card bg-white shadow-sm border-0" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<header class="post-header text-center<?php if (argon_has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') != 'true'){echo " post-header-with-thumbnail";}?>">
|
<?php $show_thumbnail_in_banner = get_option('argon_show_thumbnail_in_banner_in_content_page', 'false'); ?>
|
||||||
|
<header class="post-header text-center<?php if (argon_has_post_thumbnail() && $show_thumbnail_in_banner != 'true'){echo " post-header-with-thumbnail";}?>">
|
||||||
<?php
|
<?php
|
||||||
if (argon_has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') != 'true'){
|
if (argon_has_post_thumbnail() && $show_thumbnail_in_banner != 'true'){
|
||||||
$thumbnail_url = argon_get_post_thumbnail();
|
$thumbnail_url = argon_get_post_thumbnail();
|
||||||
echo "<img class='post-thumbnail' src='" . $thumbnail_url . "'></img>";
|
echo "<img class='post-thumbnail' src='" . $thumbnail_url . "'></img>";
|
||||||
echo "<div class='post-header-text-container'>";
|
echo "<div class='post-header-text-container'>";
|
||||||
}
|
}
|
||||||
if (argon_has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') == 'true'){
|
if (argon_has_post_thumbnail() && $show_thumbnail_in_banner == 'true'){
|
||||||
$thumbnail_url = argon_get_post_thumbnail();
|
$thumbnail_url = argon_get_post_thumbnail();
|
||||||
echo "
|
echo "
|
||||||
<style>
|
<style>
|
||||||
@@ -44,7 +45,7 @@
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if (has_post_thumbnail() && get_option('argon_show_thumbnail_in_banner_in_content_page') != 'true'){
|
if (has_post_thumbnail() && $show_thumbnail_in_banner != 'true'){
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<!-- 文章操作按钮:分享和评论 -->
|
<!-- 文章操作按钮:分享和评论 -->
|
||||||
|
<?php $argon_show_sharebtn = get_option("argon_show_sharebtn", 'true'); ?>
|
||||||
<div id="post_actions_container">
|
<div id="post_actions_container">
|
||||||
|
|
||||||
<!-- 分享功能 -->
|
<!-- 分享功能 -->
|
||||||
<?php if (get_option("argon_show_sharebtn") != 'false') { ?>
|
<?php if ($argon_show_sharebtn != 'false') { ?>
|
||||||
<div id="share_container">
|
<div id="share_container">
|
||||||
<div id="share" data-initialized="true">
|
<div id="share" data-initialized="true">
|
||||||
<?php if (get_option('argon_show_sharebtn') != 'abroad') { ?>
|
<?php if ($argon_show_sharebtn != 'abroad') { ?>
|
||||||
<a target="_blank" class="no-pjax icon-douban" tooltip="<?php _e('分享到豆瓣', 'argon'); ?>">
|
<a target="_blank" class="no-pjax icon-douban" tooltip="<?php _e('分享到豆瓣', 'argon'); ?>">
|
||||||
<button class="btn btn-icon btn-primary">
|
<button class="btn btn-icon btn-primary">
|
||||||
<span aria-hidden="true">豆</span>
|
<span aria-hidden="true">豆</span>
|
||||||
@@ -26,7 +27,7 @@
|
|||||||
<span class="btn-inner--icon"><i class="fa fa-weibo"></i></span>
|
<span class="btn-inner--icon"><i class="fa fa-weibo"></i></span>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<?php } if (get_option('argon_show_sharebtn') != 'domestic') { ?>
|
<?php } if ($argon_show_sharebtn != 'domestic') { ?>
|
||||||
<a target="_blank" class="no-pjax icon-facebook" tooltip="<?php _e('分享到 Facebook', 'argon'); ?>">
|
<a target="_blank" class="no-pjax icon-facebook" tooltip="<?php _e('分享到 Facebook', 'argon'); ?>">
|
||||||
<button class="btn btn-icon btn-primary">
|
<button class="btn btn-icon btn-primary">
|
||||||
<span class="btn-inner--icon"><i class="fa fa-facebook"></i></span>
|
<span class="btn-inner--icon"><i class="fa fa-facebook"></i></span>
|
||||||
@@ -74,7 +75,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function() {
|
(function() {
|
||||||
// 分享功能
|
// 分享功能
|
||||||
<?php if (get_option("argon_show_sharebtn") != 'false') { ?>
|
<?php if ($argon_show_sharebtn != 'false') { ?>
|
||||||
socialShare("#share", {
|
socialShare("#share", {
|
||||||
title: '<?php echo addslashes(html_entity_decode(get_the_title())); ?>',
|
title: '<?php echo addslashes(html_entity_decode(get_the_title())); ?>',
|
||||||
description: '<?php echo addslashes(html_entity_decode(wp_trim_words(html_entity_decode(get_the_content()), 50)));?>',
|
description: '<?php echo addslashes(html_entity_decode(wp_trim_words(html_entity_decode(get_the_content()), 50)));?>',
|
||||||
|
|||||||
Reference in New Issue
Block a user