已解决:short_open_tag已关闭,这就是问题所在。打开它,现在一切正常!
我正在制作一个主题,这种情况发生了。我不明白为什么代码不起作用。我已经阅读了一些类似的主题,但它们无法解决我的问题:
解析错误:语法错误, C:\ xampp \ htdocs \ wp \ wp-content \ themes \ boxtruyen \ single-ngan.php 中的意外'endif'(T_ENDIF) > 105
请帮助,我无法弄清楚错误!
<?php get_header(); ?>
<?php if(have_posts()):?>
<?php while (have_posts()):?>
<?php the_post(); tw_views($ID_parent); ?>
<input id="id_post" type="hidden" value="<?=$ID_parent?>">
<div class="container" id="truyen">
<div class="col-xs-12 col-sm-12 col-md-9 col-truyen-main">
<div class="row">
<div class="col-xs-12 col-info-desc" itemscope itemtype="http://schema.org/Book">
<div class="title-list">
<h2><span class="glyphicon glyphicon-info-sign"></span> <?the_title()?></h2>
</div>
<div class="col-xs-12">
<style>
.fix_color {
color: #C1377F;
}
.fix_color a {
color: #C1377F;
}
</style>
Đăng bởi <span class="fix_color"><?the_author()?></span>, lúc <span class="fix_color"><?the_time()?></span>, tại <span class="fix_color"><?the_category(', ')?></span>
<br/> Đọc:
<?php tw_views(get_the_ID());?>
<?php echo tw_get_views(get_the_ID())?>
<br/>
<br/>
<img class="image_ngan" src="<?=tw_get_thumbnail()?>" alt="<?the_title()?>" itemprop="image" />
<?php the_content()?>
</div>
</div>
</div>
<div class="row text-center">
<div class="hidden-xs hidden-sm hidden-md">
<div class="ads-780-90">
<?php dynamic_sidebar( 'qc-780x90');?>
</div>
</div>
<div class="hidden-lg">
<div class="ads-320-100">
<?php dynamic_sidebar( 'qc-320x100');?>
</div>
</div>
</div>
<div class="row visible-md visible-lg">
<div class="col-xs-12 comment-box">
<div class="title-list">
<h2><span class="glyphicon glyphicon-comment"></span> Bình luận</h2>
</div>
<div class="row">
<div class="fb-comments" data-href="<?the_permalink()?>" data-width="100%" data-numposts="5" data-colorscheme="light"></div>
</div>
</div>
<div class="col-xs-12 comment-box">
<div class="title-list">
<h2><span class="glyphicon glyphicon-list"></span> Cùng Chuyên Mục</h2>
</div>
<div class="row cungchuyenmuc">
<style>
.cungchuyenmuc li {
list-style: none;
width: 20%;
padding: 15px;
}
</style>
<?php $args=array( 'post_type'=> array('ngan'), 'post_status' => 'publish', 'posts_per_page' => $related_number, 'post__not_in' => array($ID_parent), 'orderby' => 'RAND' ); $list = new wp_query($args); ?>
<?php while($list->have_posts()):?>
<?php $list->the_post()?>
<li class="col-md-4 col-sm-6 col-xs-12">
<a href="<?the_permalink()?>">
<img style="max-width:100%;width:100%;max-height: 160px" src="<?=tw_get_thumbnail()?>" alt="<?the_title()?>"/><br/>
<h3 style="margin:8px 0px;text-shadow:0px 0px 1px #bbb"><?the_title()?></h3>
</a>
</li>
<?endwhile;?>
</div>
</div>
</div>
</div>
<div class="hidden-xs hidden-sm col-md-3 text-center col-truyen-side">
<div class="ads-300-250"></div>
<div class="list list-truyen col-xs-12">
<div class="title-list">
<h4><span class="glyphicon glyphicon-list"></span> Truyện đang hot</h4>
</div>
<?php $args=array( 'post_type'=> 'post', 'post_status' => 'publish', 'posts_per_page' => $so_truyen_dang_hot, 'post__not_in' => array($ID_parent), 'orderby' => 'meta_value_num', 'meta_key' => 'tw_views_post', 'ignore_sticky_posts' => -1, 'order' => 'DESC' ); $list = new wp_query($args); ?>
<?while($list->have_posts()):?>
<?$list->the_post();?>
<div class="row">
<div class="col-xs-12">
<span class="glyphicon glyphicon-chevron-right"></span>
<a href="<?the_permalink()?>" title="<?the_title()?>">
<?the_title()?>
</a>
</div>
</div>
<?endwhile;?>
</div>
<div class="ads-300-600">
<?php dynamic_sidebar( 'qc-300x600'); ?>
</div>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php get_footer(); ?>
答案 0 :(得分:-1)
请勿使用<?endwhile;?>
之类的php短标记,而是使用<?php endwhile; ?>
。将所有短标记替换为<?php ?>
。