Php Wordpress错误时结束错误500
我得到一个错误500,在查看我的错误日志时,我得到以下错误: PHP分析错误:语法错误,中出现意外的“endwhile”(T_endwhile) /var/www/site/site.com.au/wp-content/themes/site/page.php,第90行 在本代码中,第90行是结尾:Php Wordpress错误时结束错误500,php,wordpress,Php,Wordpress,我得到一个错误500,在查看我的错误日志时,我得到以下错误: PHP分析错误:语法错误,中出现意外的“endwhile”(T_endwhile) /var/www/site/site.com.au/wp-content/themes/site/page.php,第90行 在本代码中,第90行是结尾: <? while ( $query->have_posts() && $count != 3) : $query->the_post()?>
<? while ( $query->have_posts() && $count != 3) : $query->the_post()?>
<? $count++; ?>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<?php the_post_thumbnail('medium'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 post-info">
<h3><a title="<?php echo get_the_title(); ?>" href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h3>
<time><?php the_date(); ?></time>
<div class="category">
<!-- <p>Category: <a title="Posts about <?php get_category_link(get_the_category()[0]->title); ?>" href="<?php echo get_category_link(get_the_category()[0]->id); ?>"><?php the_category(', ', 'single', get_the_ID()); ?></a></p>-->
</div>
<a title="<?php echo get_the_title(); ?>" href="<?php echo get_permalink(); ?>" class="col-12 btn btn-block btn-info">Read More..</a>
</div>
</div>
<?php
endwhile; //resetting the page loop
wp_reset_query(); //resetting the page query
?>
为什么从WordPress 4.7.10迁移到最新的WP(我想是4.9)后会出现这个错误
我目前正在新环境中使用PHP7。看起来问题在于您在此处的使用:
您的while循环没有正确关闭问题是shorttags。谢谢还有,为什么会有落选的朋友?因为这是一个常见的问题,在发布任何问题之前,你都应该对它进行研发。我做了很多研发工作。这对我来说是个棘手的问题。因为你的投票是基于假设的,所以绝对无效。谢谢!谢谢你的时间。
<?php while ( $query->have_posts() && $count != 3) : $query->the_post()?>
<?php $count++; ?>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<?php the_post_thumbnail('medium'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 post-info">
<h3><a title="<?php echo get_the_title(); ?>" href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h3>
<time><?php the_date(); ?></time>
<div class="category">
<!-- <p>Category: <a title="Posts about <?php get_category_link(get_the_category()[0]->title); ?>" href="<?php echo get_category_link(get_the_category()[0]->id); ?>"><?php the_category(', ', 'single', get_the_ID()); ?></a></p>-->
</div>
<a title="<?php echo get_the_title(); ?>" href="<?php echo get_permalink(); ?>" class="col-12 btn btn-block btn-info">Read More..</a>
</div>
</div>
<?php
endwhile; //resetting the page loop
wp_reset_query(); //resetting the page query
?>