我已经为wordpress中的特定页面创建了一个新页面模板,我可以从wordpress页面模板选择中选择,但是当浏览到页面时,我得到错误500其余的网站工作正常。网站托管在CDN上并使用W3 Total Cache插件。
下面是wordpress页面模板代码:
<?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'); ?>
答案 0 :(得分:1)
试试此代码
<?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) ) {
答案 1 :(得分:0)
由于多种原因,可能导致500内部服务器错误。损坏的.htaccess
文件是常见问题之一。
您可以尝试通过登录FTP服务器来重命名该文件。另外,访问Permalinks
菜单中的Settings
页面并保存页面以生成重写规则。
此外,尝试停用缓存插件并检查页面是否正常工作。