Support » Fixing WordPress » parse error unexpected $end

  • Resolved garyb10

    (@garyb10)


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

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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.

    That wasn’t it. Thanks for the try.

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

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

    Michael

    (@alchymyth)

    Forum Moderator

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

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

    Thanks everyone!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘parse error unexpected $end’ is closed to new replies.