admin管理员组文章数量:1130349
After a recent Wordpress update, my blog page seems to be rendering the 1st post with all the other posts rendered within the same div. It was working before but since the update, this and the pagination doesn't seem to be working :/
main template file
<div class="section">
<div class="wrapper-inner">
<div class="row">
<?php if( get_option_tree( 'bloglayout' ) == 'right-sidebar' || get_option_tree( 'bloglayout' ) == '') { ?>
<div class="col-md-9 right-sidebar-class">
<?php } elseif( get_option_tree( 'bloglayout' ) == 'left-sidebar') { ?>
<?php get_sidebar(); ?>
<div class="col-md-9 left-sidebar-class">
<?php } elseif( get_option_tree( 'bloglayout' ) == 'full-width') { ?>
<div class="col-xs-12 full-width-index">
<?php } ?>
<div class="widget-blog-list">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'post-format/content', get_post_format() ); ?>
<?php endwhile; ?>
<div>
<?php the_posts_pagination( array(
'mid_size' => 2,
'prev_text' => esc_html__( 'Previous page', '' ),
'next_text' => esc_html__( 'Next page', '' ),
'before_page_number' => '<span class="meta-nav screen-reader-text"></span>',
) ); ?>
</div>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</div>
</div>
<?php if( get_option_tree( 'bloglayout' ) == 'right-sidebar' || get_option_tree( 'bloglayout' ) == '') { ?>
<?php get_sidebar(); ?>
<?php } ?>
</div>
</div>
</div>
post-format/content file
<?php
if ( ! is_single() ) :
if ( has_post_thumbnail() && ot_get_option('post_format_type_1') == 'on') :
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('blog-item'); ?>>
<?php else : ?>
<div id="post-<?php the_ID(); ?>" <?php post_class('blog-item no-left-content'); ?>style="width:400px">
<?php
endif;
endif;
?>
<?php
if ( has_post_thumbnail() ) :
$att=get_post_thumbnail_id();
$image_src = wp_get_attachment_image_src( $att, 'span5' );
$image_src = $image_src[0];
?>
<?php if ( ot_get_option('post_format_type_2') != 'on' || ot_get_option('post_format_type_1') != 'off' ) : ?>
<a href="<?php echo esc_url( get_permalink() ); ?>"><img src="<?php echo esc_url($image_src); ?>"/></a>
<?php endif; ?>
<?php if ( ot_get_option('post_format_type_2') == 'on' || ot_get_option('post_format_type_1') == 'on' ) : ?>
<div class="item-media">
<div class="media-photo">
<a href="<?php echo esc_url( get_permalink() ); ?>" data-background="<?php echo esc_url($image_src); ?>" style="background-image: url(<?php echo esc_url($image_src); ?>);"></a>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ( ! is_single() ) : ?>
<div class="item-desc">
<?php
if ( ! is_single() ) :
the_title( sprintf( '<h2 class="entry-title all-caps"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
endif;
?>
<h5><?php esc_html_e('BY', ''); ?> <a class="uppercase" href="<?php echo esc_url( get_permalink() ); ?>"><?php the_author(); ?></a> <i class="fa fa-clock-o"></i> <a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_time('F j, Y'); ?></a> <?php the_tags( '', ',', ' '); ?></h5>
<?php
/* translators: %s: Name of current post */
/* the_content( sprintf( */
/* esc_html__( 'Continue reading %s', '' ), */
/* the_title( '<span class="screen-reader-text">', '</span>', false ) */
/* ) ); */
/*
/* NEW CONTENT */
$content = get_the_content(); echo mb_strimwidth($content, 0, 220, '...');
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . esc_html__( 'Pages:', '' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
'pagelink' => '<span class="screen-reader-text">' . esc_html__( 'Page', '' ) . ' </span>%',
'separator' => '<span class="screen-reader-text">, </span>',
) );
?>
</div>
<?php endif; ?>
<?php if ( is_single() ) : ?>
<!-- Single Detail -->
<div class="single-detail">
<div class="detail-head">
<?php esc_html_e('BY', ''); ?> <a class="uppercase" href="<?php echo esc_url( get_permalink() ); ?>"><?php the_author(); ?></a> <i class="fa fa-clock-o"></i> <a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_time('F j, Y'); ?></a> <?php the_tags( '', ',', ' '); ?> <i class="fa fa-commenting-o"></i> <a class="uppercase"href="<?php comments_link(); ?> "><?php comments_number( 'no responses', 'one response', '% responses' ); ?></a>
</div>
<div class="detail-content">
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', '' ),
the_title( '<span class="screen-reader-text">', '</span>', false )
) );
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . esc_html__( 'Pages:', '' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
'pagelink' => '<span class="screen-reader-text">' . esc_html__( 'Page', '' ) . ' </span>%',
'separator' => '<span class="screen-reader-text">, </span>',
) );
?>
</div>
<div class="detail-tags">
<h5><?php esc_html_e( 'TAGS', ''); ?></h5>
<?php the_tags( '<ul><li>', '</li><li>', '</li></ul>' ); ?>
</div>
</div>
<!-- Single Detail End -->
<?php endif; ?>
The is a screen shot of the blog content section
After a recent Wordpress update, my blog page seems to be rendering the 1st post with all the other posts rendered within the same div. It was working before but since the update, this and the pagination doesn't seem to be working :/
main template file
<div class="section">
<div class="wrapper-inner">
<div class="row">
<?php if( get_option_tree( 'bloglayout' ) == 'right-sidebar' || get_option_tree( 'bloglayout' ) == '') { ?>
<div class="col-md-9 right-sidebar-class">
<?php } elseif( get_option_tree( 'bloglayout' ) == 'left-sidebar') { ?>
<?php get_sidebar(); ?>
<div class="col-md-9 left-sidebar-class">
<?php } elseif( get_option_tree( 'bloglayout' ) == 'full-width') { ?>
<div class="col-xs-12 full-width-index">
<?php } ?>
<div class="widget-blog-list">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'post-format/content', get_post_format() ); ?>
<?php endwhile; ?>
<div>
<?php the_posts_pagination( array(
'mid_size' => 2,
'prev_text' => esc_html__( 'Previous page', '' ),
'next_text' => esc_html__( 'Next page', '' ),
'before_page_number' => '<span class="meta-nav screen-reader-text"></span>',
) ); ?>
</div>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</div>
</div>
<?php if( get_option_tree( 'bloglayout' ) == 'right-sidebar' || get_option_tree( 'bloglayout' ) == '') { ?>
<?php get_sidebar(); ?>
<?php } ?>
</div>
</div>
</div>
post-format/content file
<?php
if ( ! is_single() ) :
if ( has_post_thumbnail() && ot_get_option('post_format_type_1') == 'on') :
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('blog-item'); ?>>
<?php else : ?>
<div id="post-<?php the_ID(); ?>" <?php post_class('blog-item no-left-content'); ?>style="width:400px">
<?php
endif;
endif;
?>
<?php
if ( has_post_thumbnail() ) :
$att=get_post_thumbnail_id();
$image_src = wp_get_attachment_image_src( $att, 'span5' );
$image_src = $image_src[0];
?>
<?php if ( ot_get_option('post_format_type_2') != 'on' || ot_get_option('post_format_type_1') != 'off' ) : ?>
<a href="<?php echo esc_url( get_permalink() ); ?>"><img src="<?php echo esc_url($image_src); ?>"/></a>
<?php endif; ?>
<?php if ( ot_get_option('post_format_type_2') == 'on' || ot_get_option('post_format_type_1') == 'on' ) : ?>
<div class="item-media">
<div class="media-photo">
<a href="<?php echo esc_url( get_permalink() ); ?>" data-background="<?php echo esc_url($image_src); ?>" style="background-image: url(<?php echo esc_url($image_src); ?>);"></a>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ( ! is_single() ) : ?>
<div class="item-desc">
<?php
if ( ! is_single() ) :
the_title( sprintf( '<h2 class="entry-title all-caps"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
endif;
?>
<h5><?php esc_html_e('BY', ''); ?> <a class="uppercase" href="<?php echo esc_url( get_permalink() ); ?>"><?php the_author(); ?></a> <i class="fa fa-clock-o"></i> <a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_time('F j, Y'); ?></a> <?php the_tags( '', ',', ' '); ?></h5>
<?php
/* translators: %s: Name of current post */
/* the_content( sprintf( */
/* esc_html__( 'Continue reading %s', '' ), */
/* the_title( '<span class="screen-reader-text">', '</span>', false ) */
/* ) ); */
/*
/* NEW CONTENT */
$content = get_the_content(); echo mb_strimwidth($content, 0, 220, '...');
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . esc_html__( 'Pages:', '' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
'pagelink' => '<span class="screen-reader-text">' . esc_html__( 'Page', '' ) . ' </span>%',
'separator' => '<span class="screen-reader-text">, </span>',
) );
?>
</div>
<?php endif; ?>
<?php if ( is_single() ) : ?>
<!-- Single Detail -->
<div class="single-detail">
<div class="detail-head">
<?php esc_html_e('BY', ''); ?> <a class="uppercase" href="<?php echo esc_url( get_permalink() ); ?>"><?php the_author(); ?></a> <i class="fa fa-clock-o"></i> <a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_time('F j, Y'); ?></a> <?php the_tags( '', ',', ' '); ?> <i class="fa fa-commenting-o"></i> <a class="uppercase"href="<?php comments_link(); ?> "><?php comments_number( 'no responses', 'one response', '% responses' ); ?></a>
</div>
<div class="detail-content">
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', '' ),
the_title( '<span class="screen-reader-text">', '</span>', false )
) );
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . esc_html__( 'Pages:', '' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
'pagelink' => '<span class="screen-reader-text">' . esc_html__( 'Page', '' ) . ' </span>%',
'separator' => '<span class="screen-reader-text">, </span>',
) );
?>
</div>
<div class="detail-tags">
<h5><?php esc_html_e( 'TAGS', ''); ?></h5>
<?php the_tags( '<ul><li>', '</li><li>', '</li></ul>' ); ?>
</div>
</div>
<!-- Single Detail End -->
<?php endif; ?>
The is a screen shot of the blog content section
本文标签: phpMy blog posts section seems to be rendering the other blog posts inside the first
版权声明:本文标题:php - My blog posts section seems to be rendering the other blog posts inside the first? : 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749048405a2308226.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论