From 00e2a2f39063d8c5a25765ffb4830e12e7133f7b Mon Sep 17 00:00:00 2001 From: Spirit Date: Thu, 6 Aug 2020 17:14:46 +0800 Subject: [PATCH] fix: fix pagination and alignment issue #237, fix #224 --- functions.php | 10 ---------- inc/decorate.php | 33 +++++++++++++++++++++++++++++++++ style.css | 27 +++++---------------------- tpl/content-thumb.php | 15 +-------------- 4 files changed, 39 insertions(+), 46 deletions(-) diff --git a/functions.php b/functions.php index 69252b7..0ab8fd5 100644 --- a/functions.php +++ b/functions.php @@ -1762,16 +1762,6 @@ function DEFAULT_FEATURE_IMAGE() 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->set( 'posts_per_page', get_option('posts_per_page') - sizeof(get_option( 'sticky_posts' )) ); - if ( $q->get( 'paged' ) > 1 ) - $q->set( 'post__not_in', get_option( 'sticky_posts' ) ); - } - -}); - //评论回复 function sakura_comment_notify($comment_id) { diff --git a/inc/decorate.php b/inc/decorate.php index 61fbb43..09e52e1 100644 --- a/inc/decorate.php +++ b/inc/decorate.php @@ -61,6 +61,39 @@ if ( akina_option('theme_skin') ) { ?> } + +.post-list-thumb .post-content-wrap { + float: left; + padding-left: 30px; + padding-right: 0; + text-align: right; + margin: 20px 10px 10px 0 +} +.post-list-thumb .post-thumb { + float: left +} + +.post-list-thumb .post-thumb a { + border-radius: 10px 0 0 10px +} + +.post-list-thumb:nth-child(2n) .post-content-wrap { + float: left; + padding-left: 30px; + padding-right: 0; + text-align: right; + margin: 20px 10px 10px 0 +} +.post-list-thumb:nth-child(2n) .post-thumb { + float: left +} + +.post-list-thumb:nth-child(2n) .post-thumb a { + border-radius: 10px 0 0 10px +} + + + .post-list-thumb{opacity: 0} .post-list-show {opacity: 1} diff --git a/style.css b/style.css index fb063fc..65b8630 100644 --- a/style.css +++ b/style.css @@ -1584,22 +1584,6 @@ i.iconfont.hotpost { overflow: hidden } -.post-list-thumb-left .post-content-wrap { - float: left; - padding-left: 30px; - padding-right: 0; - text-align: right; - margin: 20px 10px 10px 0 -} - -.post-list-thumb-left .post-thumb { - float: left -} - -.post-list-thumb-left .post-thumb a { - border-radius: 10px 0 0 10px -} - @media (max-width:768px) { .float-content p { height: auto; @@ -1619,12 +1603,11 @@ i.iconfont.hotpost { width: 100%; left: 0 } - .post-content-wrap, - .post-list-thumb-left .post-content-wrap { - text-align: left; - margin: 0; - padding: 20px; - float: none; + .post-list-thumb .post-content-wrap { + text-align: left !important; + margin: 0 !important; + padding: 20px !important; + float: none !important; box-shadow: none; border-top: 0 } diff --git a/tpl/content-thumb.php b/tpl/content-thumb.php index c59747b..5af043f 100644 --- a/tpl/content-thumb.php +++ b/tpl/content-thumb.php @@ -11,21 +11,8 @@ //} //add_filter('the_excerpt', 'custom_short_excerpt'); $i=0; while ( have_posts() ) : the_post(); $i++; -switch (akina_option('feature_align')) { - case "left": - $class = 'post-list-thumb-left'; - break; - case "right": - $class = ''; - break; - case "alternate": - $class = ($i%2 == 0) ? 'post-list-thumb-left' : ''; // 如果为偶数 - break; - default: - $class = ($i%2 == 0) ? 'post-list-thumb-left' : ''; -} if( $i == 1 ){ - $class .= ' post-list-show'; + $class = ' post-list-show'; } if(has_post_thumbnail()){ $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');