feat: add article status label

pull/321/head^2
Seaton Jiang 2020-12-14 14:05:34 +08:00
parent e270b99533
commit 08f316b7ce
No known key found for this signature in database
GPG Key ID: C1086BAE716FF138
10 changed files with 89 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -558,6 +558,7 @@ button:focus {
}
.k-main .board .article-panel {
position: relative;
margin: 0 0 23px;
border-radius: 0;
background-color: #fff;
@ -568,6 +569,22 @@ button:focus {
margin: 0;
}
.k-main .board .article-panel .a-card {
position: absolute;
top: -16px;
right: -1px;
}
.k-main .board .article-panel .a-card .i-card-top {
color: #0092ee;
font-size: 40px;
}
.k-main .board .article-panel .a-card .i-card-hot {
color: #dc3545;
font-size: 40px;
}
.k-main .board .article-panel .a-thumb {
position: relative;
float: left;

Binary file not shown.

View File

@ -20,6 +20,15 @@ Created by iconfont
/>
<missing-glyph />
<glyph glyph-name="card-new" unicode="&#58946;" d="M601.441 896H5.502c136.026-136.65 272.176-273.425 408.326-410.075 204.85-204.6 409.7-409.325 614.55-613.925 0.25 198.605 0.375 397.334 0.625 595.939C886.483 610.5840000000001 743.962 753.354 601.44 896zM465.416 583.104c16.612 66.327 33.225 132.653 49.713 199.104v0.625c-6.995-7.37-13.99-14.74-20.984-22.234-34.35-34.225-68.7-68.325-103.175-102.55l-17.987 17.987L516.878 819.931c8.619-8.37 17.237-16.738 25.731-25.232-3.997-17.237-7.994-34.35-11.991-51.587-11.742-47.59-23.608-95.18-35.35-142.646v-0.624c7.995 8.619 15.989 17.237 23.983 25.731 32.227 31.977 64.328 63.953 96.554 95.93 5.746-5.996 11.617-11.991 17.363-17.987L489.273 559.621c-7.87 7.87-15.863 15.614-23.857 23.483z m157.634-156.51l-95.305 95.305L671.64 665.794h0.624c31.227-31.352 62.33-62.704 93.557-94.181-5.371-5.247-10.743-10.368-16.239-15.614l-74.32 74.32h-1.874l-43.218-43.218c23.733-24.232 47.59-48.34 71.323-72.572l-16.238-16.238c-23.608 23.733-47.216 47.59-70.699 71.323h-1.249c-16.737-16.613-33.6-33.226-50.338-49.714v-1.249c25.981-26.23 51.962-52.336 77.943-78.567-5.87-4.247-11.866-8.869-17.862-13.49z m156.51-157.635l-20.36 20.36c29.354 49.964 58.707 99.927 88.186 149.89-13.99-8.368-27.98-16.737-41.97-25.231-36.348-20.36-72.696-40.72-109.17-61.205-6.745 6.995-13.615 13.99-20.36 20.985 34.975 60.705 69.95 121.535 104.924 182.241l20.36-20.36C770.192 485.05 739.215 434.463 708.238 384v-0.625c51.962 29.729 103.924 59.582 155.886 89.31l18.61-18.611c-30.227-51.213-60.33-102.3-90.558-153.513a10978.93 10978.93 0 0 1 31.227 19.236c41.345 23.233 82.69 46.341 124.16 69.574h0.624c5.996-6.245 11.991-12.366 17.987-18.611-62.33-33.85-124.534-67.826-186.613-101.8z" horiz-adv-x="1059" />
<glyph glyph-name="card-hot" unicode="&#58947;" d="M600.476 896H4.538c136.025-136.65 272.176-273.425 408.326-410.075 204.85-204.6 409.7-409.325 614.55-613.925 0.25 198.605 0.374 397.334 0.624 595.939C885.518 610.5840000000001 742.997 753.354 600.476 896z m-91.682-355.49c22.358 22.609 44.717 45.217 67.2 67.7l-74.945 74.946c-22.608-22.359-45.217-44.717-67.7-67.2l-19.236 19.235 143.894 143.895 19.236-19.236c-19.985-20.235-39.97-40.346-59.956-60.58 25.232-24.983 50.338-49.964 75.57-74.946l59.956 59.956 19.236-19.236c-48.215-47.965-96.304-95.93-144.52-143.894-6.37 6.62-12.615 12.99-18.735 19.36z m165.503-145.643c-57.707 10.867-104.423 76.569-67.2 139.648 15.238 25.73 38.222 47.215 67.7 58.707 8.369 1.748 16.738 3.622 25.231 5.37 59.957 0.5 115.916-53.21 95.93-118.662-9.118-29.728-29.853-51.463-53.336-67.201-15.613-10.367-39.97-23.233-68.325-17.862zM944.6 360.64200000000005c-15.613 15.364-31.227 30.728-46.715 46.216L770.227 279.202l-19.236 19.236 127.657 127.656c-15.364 15.614-30.728 31.227-46.216 46.716 5.246 5.371 10.367 10.742 15.613 16.238h0.625c37.347-37.597 74.695-75.195 112.167-112.667-5.37-5.371-10.742-10.493-16.238-15.739zM750.991 557.248c-12.99 10.243-23.358 16.613-47.965 16.238-6.745-1.998-13.615-3.997-20.36-5.995-21.609-9.369-39.97-28.355-51.587-47.965-25.232-42.719-1.749-89.56 38.971-99.552 64.079-15.739 140.897 89.684 80.941 137.274z" horiz-adv-x="1059" />
<glyph glyph-name="card-top" unicode="&#58948;" d="M608.49 896H29.16c132.234-132.842 264.59-265.805 396.946-398.647 199.142-198.899 398.283-397.919 597.425-596.817 0.243 193.07 0.364 386.261 0.607 579.331C885.589 618.537 747.04 757.33 608.491 896zM455.857 613.923l124.1 124.1c-14.936 15.178-29.872 30.356-44.929 45.413 5.1 5.222 10.079 10.443 15.179 15.786h0.607c36.307-36.55 72.613-73.1 109.042-109.528-5.222-5.1-10.443-10.078-15.786-15.178-15.178 14.935-30.357 29.871-45.414 44.928L474.556 595.345c-6.314 6.193-12.507 12.386-18.7 18.578z m189.427-170.12c-56.1 10.564-101.513 74.435-65.328 135.756 14.815 25.014 37.157 45.9 65.814 57.071 8.136 1.7 16.272 3.522 24.529 5.222 58.285 0.485 112.685-51.728 93.256-115.357-8.864-28.9-29.021-50.028-51.85-65.328-15.178-10.078-38.856-22.585-66.42-17.364z m198.17-83.42c-16.514 2.914-24.528 11.656-36.67 17.485l-39.1 39.1c-19.186-19.065-38.493-38.129-57.679-57.071l-18.7 18.7L831.19 518.48l25.014-25.014c17.365-17.364 40.922-33.878 48.936-59.985 11.171-36.429-23.8-79.657-61.685-73.1zM719.84 601.6600000000001c-12.628 9.956-22.707 16.15-46.628 15.785-6.557-1.943-13.236-3.886-19.793-5.829-21.007-9.107-38.857-27.564-50.15-46.628-24.528-41.528-1.7-87.064 37.886-96.778 62.292-15.3 136.97 87.185 78.685 133.45z m132.356-135.15c-6.071 5.829-12.021 11.657-18.092 17.486l-50.757-50.757c4.614-4.857 9.35-9.714 13.964-14.571 11.778-11.779 28.536-38.857 54.157-33.272 9.35 2.065 16.514 8.622 21.614 15.179 22.464 28.778-4.614 49.664-20.886 65.935z" horiz-adv-x="1059" />
<glyph glyph-name="author" unicode="&#58883;" d="M671.58673719 399.90133914c7.97933719 7.97933719 19.9483425 15.95867344 27.92767875 27.92767875 47.87602125 55.8553575 67.82436281 127.66938937 55.8553575 203.47308936-15.95867344 107.72104781-99.74171063 191.50408406-207.4627575 207.46275845-87.77270531 11.96900531-171.5557425-19.9483425-227.4111-83.78303719-43.88635219-59.84502656-67.82436281-131.6590575-55.85535844-203.47308937 11.96900531-59.84502656 39.89668406-111.71071594 87.77270531-151.6074-139.63839469-47.87602125-239.38010531-179.53507875-239.38010531-331.14247876v-87.7727053C113.0331575-74.86920336000003 156.91951062-118.75555555000005 212.77486813-118.75555555000005h598.45026375c55.8553575 0 99.74171063 43.88635219 99.74171062 99.74171063v87.7727053c0 151.6074-99.74171063 283.2664575-239.38010531 331.14247876zM384.33061063 699.1264710099999c31.91734781 39.89668406 79.79336813 59.84502656 127.66938937 59.84502563 7.97933719 0 15.95867344 0 27.92767875-3.98966813 71.81403187-11.96900531 127.66938937-71.81403187 139.63839469-139.6383947 7.97933719-51.86568938-7.97933719-99.74171063-39.89668407-135.64872656-39.89668406-43.88635219-95.7520425-67.82436281-155.59706812-55.85535749-71.81403187 11.96900531-127.66938937 71.81403187-139.63839469 139.63839469-7.97933719 47.87602125 7.97933719 99.74171063 39.89668407 135.64872656z m446.84286281-718.14031593c0-11.96900531-7.97933719-19.9483425-19.94834156-19.9483425h-598.45026375c-11.96900531 0-19.9483425 7.97933719-19.94834157 19.9483425v87.7727053c0 151.6074 123.67972125 271.29745219 271.29745219 271.29745219h91.76237344c151.6074 0 271.29745219-123.67972125 271.29745312-271.29745219v-87.7727053z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -493,4 +493,24 @@ function kratos_carousel(){
if(is_array($carousel_img)){
echo $output;
}
}
// 获取文章评论数量
function findSinglecomments($postid=0,$which=0){
$comments = get_comments('status=approve&type=comment&post_id='.$postid);
if ($comments) {
$i=0; $j=0; $commentusers=array();
foreach ($comments as $comment) {
++$i;
if ($i==1) { $commentusers[] = $comment->comment_author_email; ++$j; }
if ( !in_array($comment->comment_author_email, $commentusers) ) {
$commentusers[] = $comment->comment_author_email;
++$j;
}
}
$output = array($j,$i);
$which = ($which == 0) ? 0 : 1;
return $output[$which];
}
return 0;
}

View File

@ -429,6 +429,22 @@ function kratos_options()
'class' => 'hidden',
);
$options[] = array(
'name' => __('HOT 标签 - 评论数', 'kratos'),
'desc' => __('填写显示 HOT 标签需要的评论数', 'kratos'),
'std' => "20",
'id' => 'g_article_comment',
'type' => 'text',
);
$options[] = array(
'name' => __('HOT 标签 - 点赞数', 'kratos'),
'desc' => __('填写显示 HOT 标签需要的点赞数', 'kratos'),
'std' => "200",
'id' => 'g_article_love',
'type' => 'text',
);
$options[] = array(
'name' => __('页面布局', 'kratos'),
'desc' => __('是否显示侧边栏小工具(默认显示侧边栏),仅在文章页面生效', 'kratos'),

View File

@ -3,10 +3,17 @@
* 文章列表
* @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License
* @version 2020.09.27
* @version 2020.12.14
*/
?>
<div class="article-panel">
<span class="a-card d-none d-md-block d-lg-block">
<?php $article_comment = kratos_option('g_article_comment', '20'); $article_love = kratos_option('g_article_love', '200'); if (is_sticky()) { ?>
<i class="kicon i-card-top"></i>
<?php } elseif (findSinglecomments($post->ID) >= $article_comment || get_post_meta($post->ID, 'love', true) >= $article_love) { ?>
<i class="kicon i-card-hot"></i>
<?php } ?>
</span>
<?php if (kratos_option('g_thumbnail',true)) { ?>
<div class="a-thumb">
<a href="<?php the_permalink(); ?>">