diff --git a/README.md b/README.md index dd3e298c..5fc46bef 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Argon - 一个轻盈、简洁、美观的 WordPress 主题 # 特性 + **轻盈美观** - 使用 Argon Design System 前端框架,细节精致,轻盈美观 -+ **高度可定制化** - 可自定义主题色、页面布局、顶栏、侧栏、Banner、背景图、日夜间模式不同背景、背景沉浸、浮动操作按钮等,提供了丰富的自定义选项 ++ **高度可定制化** - 可自定义主题色、布局(双栏/单栏/三栏)、顶栏、侧栏、Banner、背景图、日夜间模式不同背景、背景沉浸、浮动操作按钮等,提供了丰富的自定义选项 + **夜间模式** - 支持日间、夜间、纯黑三种模式,并可以根据时间自动切换或跟随系统夜间模式 + **功能繁多** - Tag 和分类统计、作者链接、额外链接、文章字数和预计阅读时间、文章过时信息显示 + **Pjax** - 支持 Pjax 无刷新加载,提高浏览体验 @@ -63,6 +63,12 @@ Argon 使用 [GPL V3.0](https://github.com/solstice23/argon-theme/blob/master/LI # 更新日志 +## 20200521 v0.961 ++ 新增首页隐藏特定分类文章选项 ++ 新增文章 Meta 显示作者选项 ++ 优化分类、标签和文章中的 SEO Keywords ++ 其他小改进 + ## 20200518 v0.960 + 新增三栏布局模式 diff --git a/argontheme.js b/argontheme.js index 6f3ebbc5..9d7deee2 100644 --- a/argontheme.js +++ b/argontheme.js @@ -894,6 +894,7 @@ $(document).on("submit" , ".post-password-form" , function(){ $("body,html").animate({ scrollTop: $("#comments").offset().top - 100 }, 300); + calcHumanTimesOnPage(); }, error : function(){ pjaxLoading = false; @@ -925,6 +926,7 @@ $(document).on("submit" , ".post-password-form" , function(){ $("#comments_more").attr("href", $("#comments_more", $vdom).attr("href")); $("#comments_more").removeAttr("disabled"); } + calcHumanTimesOnPage(); }, error : function(){ pjaxLoading = false; diff --git a/functions.php b/functions.php index df8bc15a..e32ce8c3 100644 --- a/functions.php +++ b/functions.php @@ -217,7 +217,7 @@ function get_seo_description(){ } if (!post_password_required()){ return - htmlspecialchars(mb_substr(str_replace("\n", '', strip_tags(get_post($post -> ID) -> post_content)), 0, 50)) . "..."; + htmlspecialchars(mb_substr(str_replace("\n", '', strip_tags($post -> post_content)), 0, 50)) . "..."; }else{ return "这是一个加密页面,需要密码来查看"; } @@ -225,6 +225,39 @@ function get_seo_description(){ return get_option('argon_seo_description'); } } +//页面 Keywords +function get_seo_keywords(){ + if (is_single()){ + global $post; + $tags = get_the_tags('', ',', '', $post -> ID); + if ($tags != null){ + $res = ""; + foreach ($tags as $tag){ + if ($res != ""){ + $res .= ","; + } + $res .= $tag -> name; + } + return $res; + } + } + if (is_category()){ + return single_cat_title('', false); + } + if (is_tag()){ + return single_tag_title('', false); + } + if (is_author()){ + return get_the_author(); + } + if (is_post_type_archive()){ + return post_type_archive_title('', false); + } + if (is_tax()){ + return single_term_title('', false); + } + return get_option('argon_seo_keywords'); +} //页面浏览量 function get_post_views($post_id){ $count_key = 'views'; @@ -1484,6 +1517,18 @@ function argon_home_add_post_type_shuoshuo($query){ if (get_option("argon_home_show_shuoshuo") == "true"){ add_action('pre_get_posts', 'argon_home_add_post_type_shuoshuo'); } +//首页隐藏特定分类文章 +function argon_home_hide_categories($query){ + if (is_home() && $query -> is_main_query()){ + $excludeCategories = explode(",", get_option("argon_hide_categories")); + $excludeCategories = array_map(create_function('$cat', 'return "-$cat";'), $excludeCategories); + $query -> set('cat', $excludeCategories); + } + return $query; +} +if (get_option("argon_hide_categories") != ""){ + add_action('pre_get_posts', 'argon_home_hide_categories'); +} //文章过时信息显示 function argon_get_post_outdated_info(){ if (get_option("argon_outdated_info_tip_type") == "toast"){ @@ -2518,7 +2563,16 @@ function themeoptions_page(){

文章

-

文章 Meta 信息

+

文章 Meta 信息

+ + + + + @@ -3002,7 +3056,7 @@ function themeoptions_page(){

设置是否在评论区显示评论者 UA 及显示哪些部分

-

其他

+

杂项

@@ -3014,6 +3068,45 @@ function themeoptions_page(){

Pjax 可以增强页面的跳转体验

+ + + + +

输入要隐藏的 分类/Tag 的 ID,用英文逗号分隔,留空则不隐藏
点此查看所有分类和 Tag 的 ID +

分类
"; + $categories = get_categories(array( + 'hide_empty' => 0, + 'hierarchical' => 0, + 'taxonomy' => 'category' + )); + foreach($categories as $category) { + echo "".$category -> name ." -> ". $category -> term_id .""; + } + echo "
Tag
"; + $categories = get_categories(array( + 'hide_empty' => 0, + 'hierarchical' => 0, + 'taxonomy' => 'post_tag' + )); + foreach($categories as $category) { + echo "".$category -> name ." -> ". $category -> term_id .""; + } + echo ""; + ?> + +

+ + @@ -3446,6 +3539,8 @@ function argon_update_themeoptions(){ argon_update_option('argon_code_theme'); argon_update_option('argon_comment_enable_qq_avatar'); argon_update_option('argon_enable_login_css'); + argon_update_option('argon_hide_categories'); + argon_update_option('argon_show_author'); //LazyLoad 相关 argon_update_option('argon_enable_lazyload'); diff --git a/header.php b/header.php index e6b3a7e0..d652922b 100644 --- a/header.php +++ b/header.php @@ -61,8 +61,10 @@ - - + + @@ -364,11 +366,11 @@ public function end_el( &$output, $object, $depth = 0, $args = array(), $current ?>