• Hello,
    I’m doing a new theme from scratch (the previous one hasn’t been updated for serveral years) and I wanted to try it.
    Everything seemed to go well except when I want to list posts, I get this error :

    Parse error: syntax error, unexpected T_ENDWHILE in /wp-content/themes/pro/loop.php on line 41

    Here is the cleaned up code :

    <?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; ?>

    I looked up at my previous themes and the while looks OK to me. What could cause this ?

The topic ‘Unexpected T_ENDWHILE in loop.php’ is closed to new replies.