WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] parse error unexpected $end (8 posts)

  1. garyb10
    Member
    Posted 4 years ago #

    I keep getting unexpected $end parse error for index.php in the theme files. Maybe I have been looking at it too long but I can't find a php that isn't closed or is malformed. Maybe a fresh set of eyes can spot it.

    <?php
    /**
    * @package WordPress
    * @subpackage timporalrider
    */

    get_header(); ?>
    <div id="header" >
    <img src="images/trwood.jpg" width="996" height="300" alt="" />
    </div>
    <div id="main">
    <div id="sidebar">
    <?php get_sidebar(); ?>
    </div>
    <div id="right">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post">
    <h2>
    "><?php the_title(); ?>
    </h2>
    <div class="post-date">
    <?php the_time('F jS, Y'); ?>
    </div>
    <?php the_content(); ?>
    <div class="categories">
    Posted in: <?php the_category(', '); ?>
    </div>
    <div class="tags">
    Tags: <?php the_tags(); ?>
    </div>
    </div>
    </div>
    </div>
    <div style="clear:both;">
     
    </div>
    <?php get_footer(); ?>

  2. vtxyzzy
    Member
    Posted 4 years ago #

    You have "> just ahead of <?php the_title(); ?>. If something got dropped when you posted the code, be sure to use backticks before and after any code posted.

  3. garyb10
    Member
    Posted 4 years ago #

    That wasn't it. Thanks for the try.

  4. magickman5
    Member
    Posted 4 years ago #

    hi garyb10,
    you have

    <div id="right">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    but you don't have the closing if ... i.e., end-if; this is the problem..

  5. garyb10
    Member
    Posted 4 years ago #

    magickiman, if I use the php endif closing, I get a new parser error. syntax error, unexpected T_ENDIF

  6. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    the 'endwhile' is missing too.
    look into the default theme, how a proper loop has to end.

  7. vtxyzzy
    Member
    Posted 4 years ago #

    You are also missing an endwhile; just ahead of the endif;.

    <?php if (have_posts()) :
       while (have_posts()) :
          the_post(); ?>
          <div class="post">
             <h2>
                <?php the_title(); ?>
             </h2>
             <div class="post-date">
                <?php the_time('F jS, Y'); ?>
             </div>
             <?php the_content(); ?>
             <div class="categories">
                Posted in: <?php the_category(', '); ?>
             </div>
             <div class="tags">
                Tags: <?php the_tags(); ?>
             </div>
          </div>
       <?php endwhile;
    endif; ?>
  8. garyb10
    Member
    Posted 4 years ago #

    Thanks everyone!!

Topic Closed

This topic has been closed to new replies.

About this Topic