feat: add featured image controller (#148)

pull/155/head
Seaton Jiang 2020-02-26 21:42:11 +08:00
parent 0743dbb5b5
commit 29b82515f1
6 changed files with 110 additions and 73 deletions

View File

@ -435,6 +435,12 @@ button:focus {
height: 160px; height: 160px;
} }
.k-main .board .article-panel .a-post.a-none {
margin-left: 0;
padding: 20px;
height: auto;
}
.k-main .board .article-panel .a-post .header { .k-main .board .article-panel .a-post .header {
display: -webkit-box; display: -webkit-box;
overflow: hidden; overflow: hidden;
@ -601,6 +607,10 @@ button:focus {
margin-bottom: 10px; margin-bottom: 10px;
} }
.k-main .board .article-panel .a-post.a-none .content{
margin-bottom: 0;
}
.k-main .board .article-panel .a-meta { .k-main .board .article-panel .a-meta {
padding: 5px 12px; padding: 5px 12px;
} }

File diff suppressed because one or more lines are too long

View File

@ -44,6 +44,14 @@ jQuery(document).ready(function($) {
jQuery('#section-m_sendmail').show(); jQuery('#section-m_sendmail').show();
} }
jQuery('#g_thumbnail').click(function() {
jQuery('#section-g_postthumbnail').fadeToggle(400);
});
if (jQuery('#g_thumbnail:checked').val() !== undefined) {
jQuery('#section-g_postthumbnail').show();
}
jQuery('#top_select').change(function() { jQuery('#top_select').change(function() {
if (jQuery("#top_select").val() == 'color'){ if (jQuery("#top_select").val() == 'color'){
jQuery('#section-top_color').fadeIn(400); jQuery('#section-top_color').fadeIn(400);

View File

@ -3,7 +3,7 @@
* 主题选项 * 主题选项
* @author Seaton Jiang <seaton@vtrois.com> * @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License * @license MIT License
* @version 2020.02.23 * @version 2020.02.26
*/ */
function getrobots() function getrobots()
@ -199,10 +199,19 @@ function kratos_options()
'type' => 'checkbox', 'type' => 'checkbox',
); );
$options[] = array(
'name' => __('特色图片', 'kratos'),
'desc' => __('开启站点首页特色图片功能', 'kratos'),
'std' => '1',
'id' => 'g_thumbnail',
'type' => 'checkbox',
);
$options[] = array( $options[] = array(
'name' => __('默认特色图', 'kratos'), 'name' => __('默认特色图', 'kratos'),
'desc' => __('当文章中没有图片并且没有设置特色图时在首页显示', 'kratos'), 'desc' => __('当文章中没有图片并且没有设置特色图时在首页显示', 'kratos'),
'id' => 'g_postthumbnail', 'id' => 'g_postthumbnail',
'class' => 'hidden',
'std' => get_template_directory_uri() . '/assets/img/default.jpg', 'std' => get_template_directory_uri() . '/assets/img/default.jpg',
'type' => 'upload', 'type' => 'upload',
); );

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"Project-Id-Version: Kratos\n" "Project-Id-Version: Kratos\n"
"POT-Creation-Date: 2020-02-23 22:00+0800\n" "POT-Creation-Date: 2020-02-26 21:34+0800\n"
"PO-Revision-Date: 2020-02-14 23:32+0800\n" "PO-Revision-Date: 2020-02-14 23:32+0800\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -66,7 +66,7 @@ msgstr ""
msgid "搜点什么呢?" msgid "搜点什么呢?"
msgstr "" msgstr ""
#: header.php:74 inc/theme-options.php:388 #: header.php:74 inc/theme-options.php:397
msgid "一款专注于用户阅读体验的响应式博客主题" msgid "一款专注于用户阅读体验的响应式博客主题"
msgstr "" msgstr ""
@ -277,11 +277,11 @@ msgstr ""
msgid "知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议" msgid "知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议"
msgstr "" msgstr ""
#: inc/theme-options.php:40 inc/theme-options.php:371 #: inc/theme-options.php:40 inc/theme-options.php:380
msgid "图片导航" msgid "图片导航"
msgstr "" msgstr ""
#: inc/theme-options.php:41 inc/theme-options.php:363 #: inc/theme-options.php:41 inc/theme-options.php:372
msgid "颜色导航" msgid "颜色导航"
msgstr "" msgstr ""
@ -353,7 +353,7 @@ msgstr ""
msgid "Chrome 移动端浏览器导航栏的颜色" msgid "Chrome 移动端浏览器导航栏的颜色"
msgstr "" msgstr ""
#: inc/theme-options.php:114 inc/theme-options.php:256 #: inc/theme-options.php:114 inc/theme-options.php:265
msgid "微信二维码" msgid "微信二维码"
msgstr "" msgstr ""
@ -434,247 +434,255 @@ msgid "开启站点首页黑白功能用于R.I.P."
msgstr "" msgstr ""
#: inc/theme-options.php:203 #: inc/theme-options.php:203
msgid "默认特色图" msgid "特色图"
msgstr "" msgstr ""
#: inc/theme-options.php:204 #: inc/theme-options.php:204
msgid "当文章中没有图片并且没有设置特色图时在首页显示" msgid "开启站点首页特色图片功能"
msgstr "" msgstr ""
#: inc/theme-options.php:211 #: inc/theme-options.php:211
msgid "无内容图片" msgid "默认特色图"
msgstr "" msgstr ""
#: inc/theme-options.php:212 #: inc/theme-options.php:212
msgid "当文章中没有图片并且没有设置特色图时在首页显示"
msgstr ""
#: inc/theme-options.php:220
msgid "无内容图片"
msgstr ""
#: inc/theme-options.php:221
msgid "当搜索不到文章或文章分类中没有文章时显示" msgid "当搜索不到文章或文章分类中没有文章时显示"
msgstr "" msgstr ""
#: inc/theme-options.php:219 #: inc/theme-options.php:228
msgid "文章配置" msgid "文章配置"
msgstr "" msgstr ""
#: inc/theme-options.php:224 #: inc/theme-options.php:233
msgid "知识共享协议" msgid "知识共享协议"
msgstr "" msgstr ""
#: inc/theme-options.php:225 #: inc/theme-options.php:234
msgid "选择文章的知识共享协议" msgid "选择文章的知识共享协议"
msgstr "" msgstr ""
#: inc/theme-options.php:233 #: inc/theme-options.php:242
msgid "网易云音乐" msgid "网易云音乐"
msgstr "" msgstr ""
#: inc/theme-options.php:234 #: inc/theme-options.php:243
msgid "开启网易云音乐自动播放" msgid "开启网易云音乐自动播放"
msgstr "" msgstr ""
#: inc/theme-options.php:240 #: inc/theme-options.php:249
msgid "文章打赏" msgid "文章打赏"
msgstr "" msgstr ""
#: inc/theme-options.php:241 #: inc/theme-options.php:250
msgid "开启文章页面打赏功能" msgid "开启文章页面打赏功能"
msgstr "" msgstr ""
#: inc/theme-options.php:247 #: inc/theme-options.php:256
msgid "支付宝二维码" msgid "支付宝二维码"
msgstr "" msgstr ""
#: inc/theme-options.php:265 #: inc/theme-options.php:274
msgid "站长配置" msgid "站长配置"
msgstr "" msgstr ""
#: inc/theme-options.php:270 #: inc/theme-options.php:279
msgid "个人头像" msgid "个人头像"
msgstr "" msgstr ""
#: inc/theme-options.php:277 #: inc/theme-options.php:286
msgid "个人昵称" msgid "个人昵称"
msgstr "" msgstr ""
#: inc/theme-options.php:284 inc/theme-widgets.php:140 #: inc/theme-options.php:293 inc/theme-widgets.php:140
msgid "个人简介" msgid "个人简介"
msgstr "" msgstr ""
#: inc/theme-options.php:285 inc/theme-widgets.php:157 #: inc/theme-options.php:294 inc/theme-widgets.php:157
#: pages/page-toolbar.php:13 #: pages/page-toolbar.php:13
msgid "保持饥渴的专注,追求最佳的品质" msgid "保持饥渴的专注,追求最佳的品质"
msgstr "" msgstr ""
#: inc/theme-options.php:291 #: inc/theme-options.php:300
msgid "邮件配置" msgid "邮件配置"
msgstr "" msgstr ""
#: inc/theme-options.php:296 #: inc/theme-options.php:305
msgid "SMTP 服务" msgid "SMTP 服务"
msgstr "" msgstr ""
#: inc/theme-options.php:297 #: inc/theme-options.php:306
msgid "开启 SMTP 服务功能" msgid "开启 SMTP 服务功能"
msgstr "" msgstr ""
#: inc/theme-options.php:303 #: inc/theme-options.php:312
msgid "邮件服务器" msgid "邮件服务器"
msgstr "" msgstr ""
#: inc/theme-options.php:304 #: inc/theme-options.php:313
msgid "填写发件服务器地址" msgid "填写发件服务器地址"
msgstr "" msgstr ""
#: inc/theme-options.php:311 #: inc/theme-options.php:320
msgid "服务器端口" msgid "服务器端口"
msgstr "" msgstr ""
#: inc/theme-options.php:312 #: inc/theme-options.php:321
msgid "填写发件服务器端口" msgid "填写发件服务器端口"
msgstr "" msgstr ""
#: inc/theme-options.php:319 #: inc/theme-options.php:328
msgid "授权方式" msgid "授权方式"
msgstr "" msgstr ""
#: inc/theme-options.php:320 #: inc/theme-options.php:329
msgid "填写登录鉴权的方式" msgid "填写登录鉴权的方式"
msgstr "" msgstr ""
#: inc/theme-options.php:327 #: inc/theme-options.php:336
msgid "邮箱帐号" msgid "邮箱帐号"
msgstr "" msgstr ""
#: inc/theme-options.php:328 #: inc/theme-options.php:337
msgid "填写邮箱账号" msgid "填写邮箱账号"
msgstr "" msgstr ""
#: inc/theme-options.php:335 #: inc/theme-options.php:344
msgid "邮箱密码" msgid "邮箱密码"
msgstr "" msgstr ""
#: inc/theme-options.php:336 #: inc/theme-options.php:345
msgid "填写邮箱密码" msgid "填写邮箱密码"
msgstr "" msgstr ""
#: inc/theme-options.php:349 #: inc/theme-options.php:358
msgid "顶部配置" msgid "顶部配置"
msgstr "" msgstr ""
#: inc/theme-options.php:354 #: inc/theme-options.php:363
msgid "顶部样式" msgid "顶部样式"
msgstr "" msgstr ""
#: inc/theme-options.php:355 #: inc/theme-options.php:364
msgid "请选择顶部样式(颜色导航或图片导航)" msgid "请选择顶部样式(颜色导航或图片导航)"
msgstr "" msgstr ""
#: inc/theme-options.php:379 #: inc/theme-options.php:388
msgid "副标题" msgid "副标题"
msgstr "" msgstr ""
#: inc/theme-options.php:387 #: inc/theme-options.php:396
msgid "标题描述" msgid "标题描述"
msgstr "" msgstr ""
#: inc/theme-options.php:395 #: inc/theme-options.php:404
msgid "页脚配置" msgid "页脚配置"
msgstr "" msgstr ""
#: inc/theme-options.php:400 #: inc/theme-options.php:409
msgid "选择需要开启的社交图标" msgid "选择需要开启的社交图标"
msgstr "" msgstr ""
#: inc/theme-options.php:401 #: inc/theme-options.php:410
msgid "国内平台" msgid "国内平台"
msgstr "" msgstr ""
#: inc/theme-options.php:406 #: inc/theme-options.php:415
msgid "新浪微博" msgid "新浪微博"
msgstr "" msgstr ""
#: inc/theme-options.php:419 #: inc/theme-options.php:428
msgid "哔哩哔哩" msgid "哔哩哔哩"
msgstr "" msgstr ""
#: inc/theme-options.php:432 #: inc/theme-options.php:441
msgid "CODING" msgid "CODING"
msgstr "" msgstr ""
#: inc/theme-options.php:445 #: inc/theme-options.php:454
msgid "码云 Gitee" msgid "码云 Gitee"
msgstr "" msgstr ""
#: inc/theme-options.php:458 #: inc/theme-options.php:467
msgid "海外平台" msgid "海外平台"
msgstr "" msgstr ""
#: inc/theme-options.php:463 #: inc/theme-options.php:472
msgid "Twitter" msgid "Twitter"
msgstr "" msgstr ""
#: inc/theme-options.php:476 #: inc/theme-options.php:485
msgid "Telegram" msgid "Telegram"
msgstr "" msgstr ""
#: inc/theme-options.php:489 #: inc/theme-options.php:498
msgid "LinkedIn" msgid "LinkedIn"
msgstr "" msgstr ""
#: inc/theme-options.php:502 #: inc/theme-options.php:511
msgid "YouTube" msgid "YouTube"
msgstr "" msgstr ""
#: inc/theme-options.php:515 #: inc/theme-options.php:524
msgid "Github" msgid "Github"
msgstr "" msgstr ""
#: inc/theme-options.php:528 #: inc/theme-options.php:537
msgid "Stack Overflow" msgid "Stack Overflow"
msgstr "" msgstr ""
#: inc/theme-options.php:541 #: inc/theme-options.php:550
msgid "其他" msgid "其他"
msgstr "" msgstr ""
#: inc/theme-options.php:546 #: inc/theme-options.php:555
msgid "电子邮箱" msgid "电子邮箱"
msgstr "" msgstr ""
#: inc/theme-options.php:559 #: inc/theme-options.php:568
msgid "工信部备案信息" msgid "工信部备案信息"
msgstr "" msgstr ""
#: inc/theme-options.php:566 #: inc/theme-options.php:575
msgid "公安网备案信息" msgid "公安网备案信息"
msgstr "" msgstr ""
#: inc/theme-options.php:573 #: inc/theme-options.php:582
msgid "公安网备案连接" msgid "公安网备案连接"
msgstr "" msgstr ""
#: inc/theme-options.php:580 #: inc/theme-options.php:589
msgid "版权信息" msgid "版权信息"
msgstr "" msgstr ""
#: inc/theme-options.php:587 #: inc/theme-options.php:596
msgid "广告配置" msgid "广告配置"
msgstr "" msgstr ""
#: inc/theme-options.php:592 #: inc/theme-options.php:601
msgid "文章页面广告" msgid "文章页面广告"
msgstr "" msgstr ""
#: inc/theme-options.php:593 #: inc/theme-options.php:602
msgid "开启顶部广告" msgid "开启顶部广告"
msgstr "" msgstr ""
#: inc/theme-options.php:606 inc/theme-options.php:626 #: inc/theme-options.php:615 inc/theme-options.php:635
msgid "选填广告连接,如果不填则只显示图片" msgid "选填广告连接,如果不填则只显示图片"
msgstr "" msgstr ""
#: inc/theme-options.php:613 #: inc/theme-options.php:622
msgid "开启底部广告" msgid "开启底部广告"
msgstr "" msgstr ""
#: inc/theme-options.php:633 #: inc/theme-options.php:642
msgid "关于主题" msgid "关于主题"
msgstr "" msgstr ""
@ -872,19 +880,19 @@ msgstr ""
msgid "很抱歉,没有找到任何内容" msgid "很抱歉,没有找到任何内容"
msgstr "" msgstr ""
#: pages/page-content.php:27 single.php:36 #: pages/page-content.php:29 single.php:36
msgid "条评论" msgid "条评论"
msgstr "" msgstr ""
#: pages/page-content.php:30 single.php:34 #: pages/page-content.php:32 single.php:34
msgid "点热度" msgid "点热度"
msgstr "" msgstr ""
#: pages/page-content.php:31 single.php:35 #: pages/page-content.php:33 single.php:35
msgid "人点赞" msgid "人点赞"
msgstr "" msgstr ""
#: pages/page-content.php:34 #: pages/page-content.php:36
msgid "阅读全文" msgid "阅读全文"
msgstr "" msgstr ""

View File

@ -3,16 +3,18 @@
* 文章列表 * 文章列表
* @author Seaton Jiang <seaton@vtrois.com> * @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License * @license MIT License
* @version 2020.02.15 * @version 2020.02.26
*/ */
?> ?>
<div class="article-panel"> <div class="article-panel">
<?php if (kratos_option('g_thumbnail',true)) { ?>
<div class="a-thumb"> <div class="a-thumb">
<a href="<?php the_permalink(); ?>"> <a href="<?php the_permalink(); ?>">
<?php post_thumbnail(); ?> <?php post_thumbnail(); ?>
</a> </a>
</div> </div>
<div class="a-post"> <?php }?>
<div class="a-post <?php if (!kratos_option('g_thumbnail',true)) { echo 'a-none'; } ?>">
<div class="header"> <div class="header">
<?php $category = get_the_category(); echo '<a class="label" href="'. get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '<i class="label-arrow"></i></a>'; ?> <?php $category = get_the_category(); echo '<a class="label" href="'. get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '<i class="label-arrow"></i></a>'; ?>
<h3 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <h3 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>