Support » Themes and Templates » Parse error: syntax error, unexpected $end in mydirectory\index.php on line 21

  • I am getting this message, and do not know why. does anybody know why? (line 21 is the last line of code)
    Hope you can help, Thanks!
    Here is my index.php code:

    <?php get_header(); ?>
    
        <?php get_sidebar(); ?>
    
          <div class="main-content">
          <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <!-- WordPress loop here -->
            <div class="column1-unit">
              <h1><a href="<?php the_permalink() ?>" rel="bookmark" title='Click to read: "<?php strip_tags(the_title()); ?>"'><?php the_title(); ?></a></h1>
              <h3><?php the_date(); ?>, by <?php the_author(); ?></h3>
              <p><?php the_content("Continue reading '" . the_title('', '', false) . "'"); ?></p>
              <p class="details">| Posted by <?php the_author(); ?> | Categories: <?php the_category(', '); ?> | Comments: <?php comments_number('zero', 'one', 'more', 'number'); ?> |</p>
              <?php endwhile; ?>
              </div>
            <hr class="clear-contentunit" />
    
          </div>
        </div>
    <?php get_footer(); ?>
    </div>

Viewing 2 replies - 1 through 2 (of 2 total)
  • This:

    <?php if (have_posts()) : ?>

    does not have a corresponding endif, which is required. Slip this into your template:

    <?php endif; ?>

    You’ll want it after the hr tag or just above it (but definitely after the endwhile).

    ok thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Parse error: syntax error, unexpected $end in mydirectory\index.php on line 21’ is closed to new replies.