WordPress.org

Ready to get started?Download WordPress

Forums

Parse error: syntax error, unexpected $end in mydirectory\index.php on line 21 (3 posts)

  1. bobbywillmes
    Member
    Posted 6 years ago #

    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>
  2. Kafkaesqui

    Posted 6 years ago #

    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).

  3. bobbywillmes
    Member
    Posted 6 years ago #

    ok thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic