Wordpress自定义模板出现错误505
我已经为wordpress中的特定页面创建了一个新的页面模板,我可以从wordpress页面模板选择中选择该模板,但是当浏览到该页面时,我发现错误500,站点的其余部分工作正常。网站托管在CDN上,使用W3 Total Cache插件 以下是wordpress页面模板代码:Wordpress自定义模板出现错误505,wordpress,internal-server-error,custom-wordpress-pages,Wordpress,Internal Server Error,Custom Wordpress Pages,我已经为wordpress中的特定页面创建了一个新的页面模板,我可以从wordpress页面模板选择中选择该模板,但是当浏览到该页面时,我发现错误500,站点的其余部分工作正常。网站托管在CDN上,使用W3 Total Cache插件 以下是wordpress页面模板代码: <?php /* Template Name: PackageDetails */ get_header(); ?> <div class="container hds-custom"> &l
<?php
/* Template Name: PackageDetails */
get_header(); ?>
<div class="container hds-custom">
<div class="row">
<div class="grey-bg clearfix">
<div class="col-sm-6">
<?php if ( have_posts() ) {
while ( have_posts() ) {
the_post();
the_content();
}
}?>
</div>
<div class="col-sm-6">
<?php $page_images =& get_children( array ( 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image' ));
if ( empty($page_images) ) { ?>
<h2>BOOKING AND RESERVATION (24/7)</h2>
<p>MOBILE NO: <a href="tel:+123456798">123456798</a> / <a href="tel:+123456798">123456798</a></p>
<?php echo do_shortcode('[contact-form-7 id="552" title="Booking & Reservation"]')?>
<div class="alert alert-warning mt-1 mb-1">
Important note / Cancellation / Amendment / Refund policy:
</div>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt, quam.</li>
</ul>
</div>
</div>
</div>
</div>
<?php get_footer('inner'); ?>
500内部服务器错误可能是由多种原因造成的。损坏的.htaccess文件是常见问题之一 您可以尝试通过登录FTP服务器来重命名该文件。此外,请访问设置菜单中的永久链接页面并保存该页面以生成重写规则 另外,尝试停用缓存插件并检查页面是否正常工作。尝试此代码
<?php
/*
Template Name: PackageDetails
*/
get_header(); ?>
<div class="container hds-custom">
<div class="row">
<div class="grey-bg clearfix">
<div class="col-sm-6">
<?php if ( have_posts() ) {
while ( have_posts() ) {
the_post();
the_content();
}
}?>
</div>
<div class="col-sm-6">
<?php $page_images =& get_children( array ( 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image' ));
if ( empty($page_images) ) { ?>
<h2>BOOKING AND RESERVATION (24/7)</h2>
<p>MOBILE NO: <a href="tel:+123456798">123456798</a> / <a href="tel:+123456798">123456798</a></p>
<?php echo do_shortcode('[contact-form-7 id="552" title="Booking & Reservation"]')?>
<div class="alert alert-warning mt-1 mb-1">
Important note / Cancellation / Amendment / Refund policy:
</div>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt, quam.</li>
</ul>
<?php } ?>
</div>
</div>
</div>
</div>
<?php get_footer('inner'); ?>
您没有关闭if empty$page_images{good catch。违抗可能是个问题,:-但为什么是500?这应该是一个简单的PHP语法错误或异常。