php - Parse error : syntax error, unexpected end of file on line(在其他帖子中找不到解决方案)

标签 php html css

<分区>

我看过上一篇关于这个论点的帖子,但我还没有找到解决办法。我在代码中有这个错误“解析错误:语法错误,文件意外结束”,但我不明白为什么。这里的代码:

    <?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/

上一篇:HTML:意外的 Bootstrap 布局(singin 模板)

下一篇:html - 导航/标题和媒体查询问题

相关文章:

php - 更改mpdf中Ean-13的默认大小

javascript - 使用 angular 和 css 从数组数组创建自定义网格

php - 找不到类 (PHP)

php - 每个用户有多个 SQL 表?

PHP 页面在第一次单击按钮时未加载生成的值?

css - 跨度不适合圆形输入

javascript - 在 MaterializeCss Toast 中添加 Material 图标?

javascript - PHP 或 JavaScript : Allow text to appear on specific page only

php - HTML 的日期类型的输入是否存在 SQL 注入(inject)漏洞?

javascript - 如何使用 watir 访问以下元素。我总是出错