<分区>
<分区>
我看过上一篇关于这个论点的帖子,但我还没有找到解决办法。我在代码中有这个错误“解析错误:语法错误,文件意外结束”,但我不明白为什么。这里的代码:
<?php get_header(); ?>
<?php global $thr_sidebar_opts; ?>
<?php if ( $thr_sidebar_opts['use_sidebar'] == 'left' ) { get_sidebar(); } ?>
<div class="main_content_wrapper">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="breadcrumbs" typeof="BreadcrumbList" vocab="http://schema.org/">
<?php if(function_exists('bcn_display'))
{
bcn_display();
}?>
</div>
<div class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
</div>
<?php if( thr_get_option('page_show_fimg') && has_post_thumbnail() ): ?>
<div class="entry-image">
<?php $img_size = $thr_sidebar_opts['use_sidebar'] ? 'thr-layout-a' : 'thr-layout-a-nosid'; ?>
<?php the_post_thumbnail($img_size); ?>
</div>
<?php endif; ?>
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages(); ?>
</div>
<div class="clear"></div>
</article><!-- #post -->
<?php if( thr_get_option('page_show_comments') ) : ?>
<?php comments_template( '', true ); ?>
<?php endif; ?>
<?php if ( $thr_sidebar_opts['use_sidebar'] == 'right' ) { get_sidebar(); } ?>
</section>
<?php get_footer(); ?>
最佳答案
您还没有关闭 while 循环。您需要在获得侧边栏之前添加如下内容:
<?php get_header(); ?>
<?php global $thr_sidebar_opts; ?>
<?php if ( $thr_sidebar_opts['use_sidebar'] == 'left' ) { get_sidebar(); } ?>
<div class="main_content_wrapper">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="breadcrumbs" typeof="BreadcrumbList" vocab="http://schema.org/">
<?php if(function_exists('bcn_display'))
{
bcn_display();
}?>
</div>
<div class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
</div>
<?php if( thr_get_option('page_show_fimg') && has_post_thumbnail() ): ?>
<div class="entry-image">
<?php $img_size = $thr_sidebar_opts['use_sidebar'] ? 'thr-layout-a' : 'thr-layout-a-nosid'; ?>
<?php the_post_thumbnail($img_size); ?>
</div>
<?php endif; ?>
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages(); ?>
</div>
<div class="clear"></div>
</article><!-- #post -->
<?php if( thr_get_option('page_show_comments') ) : ?>
<?php comments_template( '', true ); ?>
<?php endif; ?>
<?php endwhile; ?>
<?php if ( $thr_sidebar_opts['use_sidebar'] == 'right' ) { get_sidebar(); } ?>
</section>
<?php get_footer(); ?>
关于php - Parse error : syntax error, unexpected end of file on line(在其他帖子中找不到解决方案),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34581500/