fix: fix pagination and alignment

issue #237, fix #224
pull/239/head
Spirit 2020-08-06 17:14:46 +08:00
parent fad1d9f30f
commit 00e2a2f390
4 changed files with 39 additions and 46 deletions

View File

@ -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)
{

View File

@ -61,6 +61,39 @@ if ( akina_option('theme_skin') ) { ?>
}
<?php } ?>
<?php if(akina_option('feature_align') == 'left'){ ?>
.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
}
<?php }if(akina_option('feature_align') == 'alternate'){ ?>
.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
}
<?php } ?>
.post-list-thumb{opacity: 0}
.post-list-show {opacity: 1}

View File

@ -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
}

View File

@ -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');