Skip to content

Commit

Permalink
0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
solstice23 committed Sep 23, 2019
1 parent 5903615 commit ba165a6
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 57 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ Argon - 一个轻盈、简洁、美观的 WordPress 主题

# 更新日志

## 20190923 v0.4
+ 如果某个菜单没配置,会默认隐藏,不再会影响观感
+ 修复了检测更新的一个问题
+ 增加"隐藏文字"短代码,在鼠标移上时才会显示
+ 修复图片放大模糊的问题
+ Banner 支持必应每日一图
+ 适配 Android Chrome Toolbar 颜色
+ 待审核评论会打上标签提示发送者
+ 修复 Pjax 加载后评论框大小不随内容调整的 BUG
+ 夜间模式全屏放大图片图片颜色不会变暗了
+ 修复了 CSS 的一些问题
+ 修复其他一些小问题

## 20190907 v0.31
+ 修复调试时遗留下来的一个 BUG

Expand Down
53 changes: 48 additions & 5 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function theme_slug_setup() {
//检测更新
require_once(get_template_directory() . '/theme-update-checker.php');
$argonThemeUpdateChecker = new ThemeUpdateChecker(
'Argon',
'argon',
'https://raw.githubusercontent.com/abc2237512422/argon-theme/master/info.json'
);
//注册小工具
Expand Down Expand Up @@ -194,6 +194,9 @@ function argon_comment_format($comment, $args, $depth){
<?php if( user_can($comment -> user_id , "update_core") ){
echo '<span class="badge badge-primary badge-admin">博主</span>';}
?>
<?php if( $comment -> comment_approved == 0 ){
echo '<span class="badge badge-warning badge-unapproved">待审核</span>';}
?>
</div>
<div class="comment-item-text">
<?php comment_text();?>
Expand Down Expand Up @@ -324,6 +327,28 @@ function check_comment_captcha($comment){
if($comment_data['comment_type'] == ''){
add_filter('preprocess_comment' , 'check_comment_captcha');
}
//获取顶部 Banner 背景图(用户指定或必应日图)
function get_banner_background_url(){
$url = get_option("argon_banner_background_url");
if ($url == "--bing--"){
$lastUpdated = get_option("argon_bing_banner_background_last_updated_time");
if ($lastUpdated == ""){
$lastUpdated = 0;
}
$now = time();
if ($now - $lastUpdated < 3600){
return get_option("argon_bing_banner_background_last_updated_url");
}else{
$data = json_decode(@file_get_contents('https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1') , true);
$url = "//bing.com" . $data['images'][0]['url'];
update_option("argon_bing_banner_background_last_updated_time" , $now);
update_option("argon_bing_banner_background_last_updated_url" , $url);
return $url;
}
}else{
return $url;
}
}
//Lazyload 对 <img> 标签预处理和加入 <script> 以加载 Lazyload
function argon_lazyload($content){
$lazyload_effect = get_option('argon_lazyload_effect');
Expand Down Expand Up @@ -662,7 +687,7 @@ function shortcode_friend_link($attr,$content=""){
<div class='friend-link-avatar'>
<a target='_blink' href='" . $now[1] . "'>";
if (!ctype_space($now[4]) && $now[4] != '' && isset($now[4])){
$out .= "<img src='" . $now[4] . "' class='icon bg-gradient-secondary rounded-circle text-white'>
$out .= "<img src='" . $now[4] . "' class='icon bg-gradient-secondary rounded-circle text-white' style='pointer-events: none;'>
</img>";
}else{
$out .= "<div class='icon icon-shape bg-gradient-primary rounded-circle text-white'>" . mb_substr($now[2], 0, 1) . "
Expand Down Expand Up @@ -724,6 +749,23 @@ function shortcode_timeline($attr,$content=""){
$out .= "</div>";
return $out;
}
add_shortcode('hidden','shortcode_hidden');
function shortcode_hidden($attr,$content=""){
$out = "<span class='argon-hidden-text";
$tip = isset($attr['tip']) ? $attr['tip'] : '';
$type = isset($attr['type']) ? $attr['type'] : 'blur';
if ($type == "background"){
$out .= " argon-hidden-text-background";
}else{
$out .= " argon-hidden-text-blur";
}
$out .= "'";
if ($tip != ''){
$out .= " title='" . $tip ."'";
}
$out .= ">" . $content . "</span>";
return $out;
}
add_shortcode('hide_reading_time','shortcode_hide_reading_time');
function shortcode_hide_reading_time($attr,$content=""){
return "";
Expand All @@ -736,6 +778,7 @@ function themeoptions_admin_menu(){
function themeoptions_page(){
/*具体选项*/
?>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/jquery/jquery.min.js"></script>
<div>
<h1>Argon 主题设置</h1>
<form method="POST" action="">
Expand All @@ -750,8 +793,8 @@ function themeoptions_page(){
<h4>Banner 标题</h4>
<p><input type="text" name="argon_banner_title" value="<?php echo get_option('argon_banner_title'); ?>"/> 留空则显示博客名称</p>
<h4>Banner 背景图</h4>
<p><input type="text" name="argon_banner_background_url" value="<?php echo get_option('argon_banner_background_url'); ?>"/> 需带上 http(s)
,留空则显示默认背景 (即将支持必应每日一图)</p>
<p><input type="text" name="argon_banner_background_url" id="argon_banner_background_url" value="<?php echo get_option('argon_banner_background_url'); ?>"/> 需带上 http(s)
,留空则显示默认背景 <button onclick="$('input#argon_banner_background_url').val('--bing--');" class="button">使用必应每日一图</button></p>
<h4>Banner 渐变背景样式(如果设置了背景图则不生效)</h4>
<p>
<select name="argon_banner_background_color_type">
Expand Down Expand Up @@ -990,7 +1033,7 @@ function themeoptions_page(){
<option value="disabled" <?php if ($enable_smoothscroll_type=='disabled'){echo 'selected';} ?>>不使用平滑滚动</option>
</select>
</p>
<input type="submit" name="admin_options" value="确认"/></p>
<input type="submit" name="admin_options" value="保存" class="button"/></p>
</form>
</div>
<?php
Expand Down
25 changes: 14 additions & 11 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

<script src="<?php bloginfo('template_url'); ?>/assets/js/argon.min.js"></script>
<?php wp_head(); ?>
<meta name="theme-color" content="#5e72e4">
</head>

<?php echo get_option('argon_custom_html_head'); ?>
Expand Down Expand Up @@ -123,15 +124,17 @@ public function end_el( &$output, $object, $depth = 0, $args = array(), $current
}
}
}
echo "<ul class='navbar-nav navbar-nav-hover align-items-lg-center'>";
wp_nav_menu( array(
'container' => '',
'theme_location' => 'toolbar_menu',
'items_wrap' => '%3$s',
'depth' => 0,
'walker' => new toolbarMenuWalker()
) );
echo "</ul>";
if ( has_nav_menu('toolbar_menu') ){
echo "<ul class='navbar-nav navbar-nav-hover align-items-lg-center'>";
wp_nav_menu( array(
'container' => '',
'theme_location' => 'toolbar_menu',
'items_wrap' => '%3$s',
'depth' => 0,
'walker' => new toolbarMenuWalker()
) );
echo "</ul>";
}
?>
<ul class="navbar-nav align-items-lg-center ml-lg-auto">
<li class="nav-item" data-toggle="modal" data-target="#argon_search_modal">
Expand Down Expand Up @@ -163,7 +166,7 @@ public function end_el( &$output, $object, $depth = 0, $args = array(), $current
</div>
</div>
<!--Banner-->
<section id="banner" class="banner section section-lg section-shaped">
<section id="banner" class="banner section section-lg section-shaped banner-background-loading">
<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'); ?>">
<span></span>
<span></span>
Expand All @@ -181,7 +184,7 @@ public function end_el( &$output, $object, $depth = 0, $args = array(), $current
<?php if (get_option('argon_banner_background_url') != '') { ?>
<style>
section.banner{
background-image: url(<?php echo get_option('argon_banner_background_url') ?>) !important;
background-image: url(<?php echo get_banner_background_url();; ?>) !important;
}
</style>
<?php } ?>
Expand Down
2 changes: 1 addition & 1 deletion js/argontheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
});

//输入框细节
$("#post_comment_content").on("change input keyup propertychange" , function(){
$(document).on("change input keydown keyup propertychange" , "#post_comment_content" , function(){
$("#post_comment_content_hidden")[0].innerText = $("#post_comment_content").val() + "\n";
$("#post_comment_content").css("height" , $("#post_comment_content_hidden").outerHeight());
});
Expand Down
64 changes: 37 additions & 27 deletions sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ public function end_el( &$output, $object, $depth = 0, $args = array(), $current
}
}
echo "<ul id='leftbar_part1_menu' class='leftbar-menu'>";
wp_nav_menu( array(
'container' => '',
'theme_location' => 'leftbar_menu',
'items_wrap' => '%3$s',
'depth' => 0,
'walker' => new leftbarMenuWalker()
) );
if ( has_nav_menu('leftbar_menu') ){
wp_nav_menu( array(
'container' => '',
'theme_location' => 'leftbar_menu',
'items_wrap' => '%3$s',
'depth' => 0,
'walker' => new leftbarMenuWalker()
) );
}
echo "</ul>";
?>
<div class="card-body text-center leftbar-search-button">
Expand Down Expand Up @@ -124,15 +126,18 @@ public function end_el( &$output, $object, $depth = 0, $args = array(), $current
}
}
}
echo "<div class='site-author-links'>";
wp_nav_menu( array(
'container' => '',
'theme_location' => 'leftbar_author_links',
'items_wrap' => '%3$s',
'depth' => 0,
'walker' => new leftbarAuthorLinksWalker()
) );
echo "</div>";

if ( has_nav_menu('leftbar_author_links') ){
echo "<div class='site-author-links'>";
wp_nav_menu( array(
'container' => '',
'theme_location' => 'leftbar_author_links',
'items_wrap' => '%3$s',
'depth' => 0,
'walker' => new leftbarAuthorLinksWalker()
) );
echo "</div>";
}
?>
<?php
/*侧栏友情链接*/
Expand All @@ -150,17 +155,22 @@ public function end_el( &$output, $object, $depth = 0, $args = array(), $current
}
}
}
echo "<div class='site-friend-links'>
<div class='site-friend-links-title'><i class='fa fa-fw fa-link'></i> Links</div>
<ul class='site-friend-links-ul'>";
wp_nav_menu( array(
'container' => '',
'theme_location' => 'leftbar_friend_links',
'items_wrap' => '%3$s',
'depth' => 0,
'walker' => new leftbarFriendLinksWalker()
) );
echo "</ul></div>";

if ( has_nav_menu('leftbar_friend_links') ){
echo "<div class='site-friend-links'>
<div class='site-friend-links-title'><i class='fa fa-fw fa-link'></i> Links</div>
<ul class='site-friend-links-ul'>";
wp_nav_menu( array(
'container' => '',
'theme_location' => 'leftbar_friend_links',
'items_wrap' => '%3$s',
'depth' => 0,
'walker' => new leftbarFriendLinksWalker()
) );
echo "</ul></div>";
}else{
echo "<div style='height: 20px;'></div>";
}
?>
</div>
<?php if ( is_active_sidebar( 'leftbar-tools' ) ){?>
Expand Down
Loading

0 comments on commit ba165a6

Please sign in to comment.