【发布时间】:2013-12-31 15:15:37
【问题描述】:
我正在从头开始制作一个新主题(以前的主题已经好几年没有更新了),我想尝试一下。 一切似乎都很顺利,除了当我想列出帖子时,我收到了这个错误:
解析错误:语法错误,第 41 行 /wp-content/themes/pro/loop.php 中的意外 T_ENDWHILE
这是清理后的代码:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="panel panel-default">
<div class="panel-heading">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><small>, le <?php the_date(); ?></small></h2>
</div>
<div class="panel-body">
<?php
if ( $post->post_excerpt ){
the_excerpt();?>
<div class="btn-group">
<button type="button" class="btn btn-default"><a href="<?php the_permalink(); ?>">Lire la suite <i class="fa fa-arrow-right fa-fw"></i></a></button>
</div>
<?php }
else {
the_content();?>
</div>
<div class="panel-footer">
<div class="btn-group">
<button type="button" class="btn btn-default"><a href="<?php the_permalink(); ?>#comments"><i class="fa fa-comments fa-fw"></i> <?php get_comments_number(); ?></a></button>
</div>
<i class="fa fa-folder-open fa-fw"></i> Catégories : <?php the_category(', ') ?>
</div>
</div>
<?php endwhile; ?>
<?php else : ?>
<div class="jumbotron">
<h1>Il n'y a rien à afficher.</h1>
</div>
<?php endif; ?>
我将其用作 index/archive/tags.php :
<?php
get_header();
get_template_part('loop');
get_footer();
?>
我查看了以前的主题,我觉得它看起来不错。什么可能导致此错误?
【问题讨论】:
标签: php wordpress-theming wordpress