每当我为一个页面激活此页面模板时,我都会收到此消息,例如关于。php:
分析错误:语法错误,在/home/u425744603/public\\u html/wp content/themes/helle/page notime中出现意外的文件结尾。php在线1
没有错误!这实际上是我已经使用了几个星期的同一个模板,它工作得非常好。
这是模板的代码:
<?php
/* Template Name: Page Without Time */
?>
<?php get_header(); ?>
<div id="container">
<div id="columns">
<div class="col-9">
<div id="content">
<?php /* Top post navigation */ ?>
<?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
<div id="nav-above" class="navigation">
<div class="nav-previous"><?php next_posts_link(__( \'<span class="meta-nav">«</span> Older posts\', \'your-theme\' )) ?></div>
<div class="nav-next"><?php previous_posts_link(__( \'Newer posts <span class="meta-nav">»</span>\', \'your-theme\' )) ?></div>
</div><!-- #nav-above -->
<?php } ?>
<?php
if ( have_posts() ) {
$post = $posts[0]; $c=0;
while ( have_posts() ) {
the_post();
$c++;
if ( $c == count( $posts ) ) { ?>
<h1><?php the_title(); ?></h1>
<p><?php the_content(); ?></p>
<?php get_template_part( \'content\', get_post_format() ); ?>
<div style="width: 100%; border:none;"></div>
<?php
}
else { ?>
<h1><?php the_title(); ?></h1>
<p><?php the_content(); ?></p>
<?php get_template_part( \'content\', get_post_format() ); ?>
<div style="width: 100%; border-bottom: 1px solid #000;"></div>
<?php
}
} // end while
} // end if
?>
<?php /* Bottom post navigation */ ?>
<?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
<div id="nav-below" class="navigation">
<div class="nav-previous"><?php next_posts_link(__( \'<span class="meta-nav">«</span> Older posts\', \'your-theme\' )) ?></div>
<div class="nav-next"><?php previous_posts_link(__( \'Newer posts <span class="meta-nav">»</span>\', \'your-theme\' )) ?></div>
</div><!-- #nav-below -->
<?php } ?>
</div><!-- #content -->
</div>
<div class="col-3 grey">
<p>Hoi</p>
</div>
</div>
</div><!-- #container -->
<div id="primary" class="widget-area">
</div><!-- #primary .widget-area -->
<div id="secondary" class="widget-area">
</div><!-- #secondary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
如果有人能告诉我为什么我会突然出现这个错误,我将不胜感激。