fix: fix query loop

sticky posts also display in the loop, and fix post list thumb align
fix#205
This commit is contained in:
Spirit 2020-03-28 10:36:34 +08:00
parent df1c5bac14
commit b169c36931
7 changed files with 69 additions and 76 deletions

View File

@ -1757,14 +1757,6 @@ function DEFAULT_FEATURE_IMAGE()
return rest_url('sakura/v1/image/feature') . '?' . rand(1, 1000); return rest_url('sakura/v1/image/feature') . '?' . rand(1, 1000);
} }
//防止设置置顶文章造成的图片同侧bug
add_action('pre_get_posts', function ($q) {
if ($q->is_home() && $q->is_main_query() && $q->get('paged') > 1) {
$q->set('post__not_in', get_option('sticky_posts'));
}
});
//评论回复 //评论回复
function sakura_comment_notify($comment_id) function sakura_comment_notify($comment_id)
{ {

Binary file not shown.

View File

@ -1,8 +1,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Sakura\n" "Project-Id-Version: Sakura\n"
"POT-Creation-Date: 2020-02-13 23:59+0800\n" "POT-Creation-Date: 2020-03-28 10:35+0800\n"
"PO-Revision-Date: 2020-02-13 23:59+0800\n" "PO-Revision-Date: 2020-03-28 10:35+0800\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: en_US\n" "Language: en_US\n"
@ -142,74 +142,74 @@ msgstr ""
msgid "Nav Menus" msgid "Nav Menus"
msgstr "" msgstr ""
#: functions.php:420 inc/theme_plus.php:186 layouts/authorprofile.php:11 #: functions.php:421 inc/theme_plus.php:186 layouts/authorprofile.php:11
#: options.php:121 #: options.php:121
msgid "Author" msgid "Author"
msgstr "" msgstr ""
#: functions.php:420 #: functions.php:421
msgid "Blogger" msgid "Blogger"
msgstr "" msgstr ""
#: functions.php:424 #: functions.php:425
msgid "Location" msgid "Location"
msgstr "" msgstr ""
#: functions.php:428 #: functions.php:429
msgid "Private" msgid "Private"
msgstr "" msgstr ""
#: functions.php:430 #: functions.php:431
msgid "Yes" msgid "Yes"
msgstr "" msgstr ""
#: functions.php:432 #: functions.php:433
msgid "No" msgid "No"
msgstr "" msgstr ""
#: functions.php:435 #: functions.php:436
msgid "Edit" msgid "Edit"
msgstr "" msgstr ""
#: functions.php:524 #: functions.php:525
msgid "" msgid ""
"Please install pulgin <a href=\"https://wordpress.org/plugins/wp-statistics/" "Please install pulgin <a href=\"https://wordpress.org/plugins/wp-statistics/"
"\" target=\"_blank\">WP-Statistics</a>" "\" target=\"_blank\">WP-Statistics</a>"
msgstr "" msgstr ""
#: functions.php:574 #: functions.php:575
msgid "This guy is so lazy ╮(╯▽╰)╭" msgid "This guy is so lazy ╮(╯▽╰)╭"
msgstr "" msgstr ""
#: functions.php:1329 #: functions.php:1330
msgid "All expand/collapse" msgid "All expand/collapse"
msgstr "" msgstr ""
#: functions.php:1350 options.php:834 #: functions.php:1351 options.php:834
msgid " " msgid " "
msgstr "" msgstr ""
#: functions.php:1354 #: functions.php:1355
msgid " post(s)" msgid " post(s)"
msgstr "" msgstr ""
#: functions.php:1377 functions.php:1380 inc/theme_plus.php:478 #: functions.php:1378 functions.php:1381 inc/theme_plus.php:478
msgid "Dashboard" msgid "Dashboard"
msgstr "" msgstr ""
#: functions.php:1606 #: functions.php:1607
msgid "<b>ERROR</b>: This email domain (<b>@" msgid "<b>ERROR</b>: This email domain (<b>@"
msgstr "" msgstr ""
#: functions.php:1711 #: functions.php:1712
msgid "QQ" msgid "QQ"
msgstr "" msgstr ""
#: functions.php:1781 #: functions.php:1774
msgid "Sidebar" msgid "Sidebar"
msgstr "" msgstr ""
#: functions.php:1893 #: functions.php:1886
msgid "" msgid ""
"<b> For a better experience, please do not set <a href=\"/wp-admin/options-" "<b> For a better experience, please do not set <a href=\"/wp-admin/options-"
"permalink.php\"> permalink </a> as plain. To do this, you may need to " "permalink.php\"> permalink </a> as plain. To do this, you may need to "
@ -222,7 +222,7 @@ msgstr ""
msgid "page %s " msgid "page %s "
msgstr "" msgstr ""
#: inc/api.php:301 inc/theme_plus.php:727 #: inc/api.php:304 inc/theme_plus.php:727
msgid "The comment is private" msgid "The comment is private"
msgstr "" msgstr ""
@ -1710,17 +1710,17 @@ msgstr "Search result: %s"
msgid "NOTHING" msgid "NOTHING"
msgstr "" msgstr ""
#: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:56 #: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:57
#: tpl/content.php:34 #: tpl/content.php:34
msgid "Comment" msgid "Comment"
msgstr "" msgstr ""
#: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:56 #: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:57
#: tpl/content.php:34 #: tpl/content.php:34
msgid "Comments" msgid "Comments"
msgstr "" msgstr ""
#: tpl/content-image.php:38 tpl/content-status.php:34 tpl/content-thumb.php:55 #: tpl/content-image.php:38 tpl/content-status.php:34 tpl/content-thumb.php:56
#: tpl/content.php:37 #: tpl/content.php:37
msgid "Hit" msgid "Hit"
msgid_plural "Hits" msgid_plural "Hits"

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: Sakura\n" "Project-Id-Version: Sakura\n"
"POT-Creation-Date: 2020-02-13 23:59+0800\n" "POT-Creation-Date: 2020-03-28 10:34+0800\n"
"PO-Revision-Date: 2019-11-01 14:27+0800\n" "PO-Revision-Date: 2019-11-01 14:27+0800\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -142,73 +142,73 @@ msgstr ""
msgid "Nav Menus" msgid "Nav Menus"
msgstr "" msgstr ""
#: functions.php:420 inc/theme_plus.php:186 layouts/authorprofile.php:11 options.php:121 #: functions.php:421 inc/theme_plus.php:186 layouts/authorprofile.php:11 options.php:121
msgid "Author" msgid "Author"
msgstr "" msgstr ""
#: functions.php:420 #: functions.php:421
msgid "Blogger" msgid "Blogger"
msgstr "" msgstr ""
#: functions.php:424 #: functions.php:425
msgid "Location" msgid "Location"
msgstr "" msgstr ""
#: functions.php:428 #: functions.php:429
msgid "Private" msgid "Private"
msgstr "" msgstr ""
#: functions.php:430 #: functions.php:431
msgid "Yes" msgid "Yes"
msgstr "" msgstr ""
#: functions.php:432 #: functions.php:433
msgid "No" msgid "No"
msgstr "" msgstr ""
#: functions.php:435 #: functions.php:436
msgid "Edit" msgid "Edit"
msgstr "" msgstr ""
#: functions.php:524 #: functions.php:525
msgid "" msgid ""
"Please install pulgin <a href=\"https://wordpress.org/plugins/wp-statistics/\" target=\"_blank" "Please install pulgin <a href=\"https://wordpress.org/plugins/wp-statistics/\" target=\"_blank"
"\">WP-Statistics</a>" "\">WP-Statistics</a>"
msgstr "" msgstr ""
#: functions.php:574 #: functions.php:575
msgid "This guy is so lazy ╮(╯▽╰)╭" msgid "This guy is so lazy ╮(╯▽╰)╭"
msgstr "" msgstr ""
#: functions.php:1329 #: functions.php:1330
msgid "All expand/collapse" msgid "All expand/collapse"
msgstr "" msgstr ""
#: functions.php:1350 options.php:834 #: functions.php:1351 options.php:834
msgid " " msgid " "
msgstr "" msgstr ""
#: functions.php:1354 #: functions.php:1355
msgid " post(s)" msgid " post(s)"
msgstr "" msgstr ""
#: functions.php:1377 functions.php:1380 inc/theme_plus.php:478 #: functions.php:1378 functions.php:1381 inc/theme_plus.php:478
msgid "Dashboard" msgid "Dashboard"
msgstr "" msgstr ""
#: functions.php:1606 #: functions.php:1607
msgid "<b>ERROR</b>: This email domain (<b>@" msgid "<b>ERROR</b>: This email domain (<b>@"
msgstr "" msgstr ""
#: functions.php:1711 #: functions.php:1712
msgid "QQ" msgid "QQ"
msgstr "" msgstr ""
#: functions.php:1781 #: functions.php:1774
msgid "Sidebar" msgid "Sidebar"
msgstr "" msgstr ""
#: functions.php:1893 #: functions.php:1886
msgid "" msgid ""
"<b> For a better experience, please do not set <a href=\"/wp-admin/options-permalink.php\"> " "<b> For a better experience, please do not set <a href=\"/wp-admin/options-permalink.php\"> "
"permalink </a> as plain. To do this, you may need to configure <a href=\"https://www.wpdaxue." "permalink </a> as plain. To do this, you may need to configure <a href=\"https://www.wpdaxue."
@ -220,7 +220,7 @@ msgstr ""
msgid "page %s " msgid "page %s "
msgstr "" msgstr ""
#: inc/api.php:301 inc/theme_plus.php:727 #: inc/api.php:304 inc/theme_plus.php:727
msgid "The comment is private" msgid "The comment is private"
msgstr "" msgstr ""
@ -1675,15 +1675,15 @@ msgstr ""
msgid "NOTHING" msgid "NOTHING"
msgstr "" msgstr ""
#: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:56 tpl/content.php:34 #: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:57 tpl/content.php:34
msgid "Comment" msgid "Comment"
msgstr "" msgstr ""
#: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:56 tpl/content.php:34 #: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:57 tpl/content.php:34
msgid "Comments" msgid "Comments"
msgstr "" msgstr ""
#: tpl/content-image.php:38 tpl/content-status.php:34 tpl/content-thumb.php:55 tpl/content.php:37 #: tpl/content-image.php:38 tpl/content-status.php:34 tpl/content-thumb.php:56 tpl/content.php:37
msgid "Hit" msgid "Hit"
msgid_plural "Hits" msgid_plural "Hits"
msgstr[0] "" msgstr[0] ""

Binary file not shown.

View File

@ -1,8 +1,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Sakura\n" "Project-Id-Version: Sakura\n"
"POT-Creation-Date: 2020-02-13 23:59+0800\n" "POT-Creation-Date: 2020-03-28 10:34+0800\n"
"PO-Revision-Date: 2020-02-13 23:59+0800\n" "PO-Revision-Date: 2020-03-28 10:35+0800\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: zh_CN\n" "Language: zh_CN\n"
@ -142,36 +142,36 @@ msgstr "小工具"
msgid "Nav Menus" msgid "Nav Menus"
msgstr "导航菜单" msgstr "导航菜单"
#: functions.php:420 inc/theme_plus.php:186 layouts/authorprofile.php:11 #: functions.php:421 inc/theme_plus.php:186 layouts/authorprofile.php:11
#: options.php:121 #: options.php:121
msgid "Author" msgid "Author"
msgstr "作者" msgstr "作者"
#: functions.php:420 #: functions.php:421
msgid "Blogger" msgid "Blogger"
msgstr "博主" msgstr "博主"
#: functions.php:424 #: functions.php:425
msgid "Location" msgid "Location"
msgstr "来自" msgstr "来自"
#: functions.php:428 #: functions.php:429
msgid "Private" msgid "Private"
msgstr "私密" msgstr "私密"
#: functions.php:430 #: functions.php:431
msgid "Yes" msgid "Yes"
msgstr "是" msgstr "是"
#: functions.php:432 #: functions.php:433
msgid "No" msgid "No"
msgstr "否" msgstr "否"
#: functions.php:435 #: functions.php:436
msgid "Edit" msgid "Edit"
msgstr "编辑" msgstr "编辑"
#: functions.php:524 #: functions.php:525
msgid "" msgid ""
"Please install pulgin <a href=\"https://wordpress.org/plugins/wp-statistics/" "Please install pulgin <a href=\"https://wordpress.org/plugins/wp-statistics/"
"\" target=\"_blank\">WP-Statistics</a>" "\" target=\"_blank\">WP-Statistics</a>"
@ -179,39 +179,39 @@ msgstr ""
"请安装插件 <a href=\"https://wordpress.org/plugins/wp-statistics/\" target=" "请安装插件 <a href=\"https://wordpress.org/plugins/wp-statistics/\" target="
"\"_blank\">WP-Statistics</a>" "\"_blank\">WP-Statistics</a>"
#: functions.php:574 #: functions.php:575
msgid "This guy is so lazy ╮(╯▽╰)╭" msgid "This guy is so lazy ╮(╯▽╰)╭"
msgstr "这家伙好懒╮(╯▽╰)╭" msgstr "这家伙好懒╮(╯▽╰)╭"
#: functions.php:1329 #: functions.php:1330
msgid "All expand/collapse" msgid "All expand/collapse"
msgstr "全部展开/收缩" msgstr "全部展开/收缩"
#: functions.php:1350 options.php:834 #: functions.php:1351 options.php:834
msgid " " msgid " "
msgstr "" msgstr ""
#: functions.php:1354 #: functions.php:1355
msgid " post(s)" msgid " post(s)"
msgstr " 篇文章" msgstr " 篇文章"
#: functions.php:1377 functions.php:1380 inc/theme_plus.php:478 #: functions.php:1378 functions.php:1381 inc/theme_plus.php:478
msgid "Dashboard" msgid "Dashboard"
msgstr "管理中心" msgstr "管理中心"
#: functions.php:1606 #: functions.php:1607
msgid "<b>ERROR</b>: This email domain (<b>@" msgid "<b>ERROR</b>: This email domain (<b>@"
msgstr "" msgstr ""
#: functions.php:1711 #: functions.php:1712
msgid "QQ" msgid "QQ"
msgstr "" msgstr ""
#: functions.php:1781 #: functions.php:1774
msgid "Sidebar" msgid "Sidebar"
msgstr "侧栏" msgstr "侧栏"
#: functions.php:1893 #: functions.php:1886
msgid "" msgid ""
"<b> For a better experience, please do not set <a href=\"/wp-admin/options-" "<b> For a better experience, please do not set <a href=\"/wp-admin/options-"
"permalink.php\"> permalink </a> as plain. To do this, you may need to " "permalink.php\"> permalink </a> as plain. To do this, you may need to "
@ -227,7 +227,7 @@ msgstr ""
msgid "page %s " msgid "page %s "
msgstr "第 %s 页 " msgstr "第 %s 页 "
#: inc/api.php:301 inc/theme_plus.php:727 #: inc/api.php:304 inc/theme_plus.php:727
msgid "The comment is private" msgid "The comment is private"
msgstr "该评论为私密评论" msgstr "该评论为私密评论"
@ -1764,17 +1764,17 @@ msgstr "关于 %s 的搜索结果:"
msgid "NOTHING" msgid "NOTHING"
msgstr "啥也没有呀" msgstr "啥也没有呀"
#: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:56 #: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:57
#: tpl/content.php:34 #: tpl/content.php:34
msgid "Comment" msgid "Comment"
msgstr "条评论" msgstr "条评论"
#: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:56 #: tpl/content-image.php:35 tpl/content-status.php:31 tpl/content-thumb.php:57
#: tpl/content.php:34 #: tpl/content.php:34
msgid "Comments" msgid "Comments"
msgstr "条评论" msgstr "条评论"
#: tpl/content-image.php:38 tpl/content-status.php:34 tpl/content-thumb.php:55 #: tpl/content-image.php:38 tpl/content-status.php:34 tpl/content-thumb.php:56
#: tpl/content.php:37 #: tpl/content.php:37
msgid "Hit" msgid "Hit"
msgid_plural "Hits" msgid_plural "Hits"

View File

@ -11,6 +11,7 @@
//} //}
//add_filter('the_excerpt', 'custom_short_excerpt'); //add_filter('the_excerpt', 'custom_short_excerpt');
$i=0; while ( have_posts() ) : the_post(); $i++; $i=0; while ( have_posts() ) : the_post(); $i++;
if(is_sticky()) $i++;
switch (akina_option('feature_align')) { switch (akina_option('feature_align')) {
case "left": case "left":
$class = 'post-list-thumb-left'; $class = 'post-list-thumb-left';