Title: Parse error: syntax error, unexpected T_ENDWHILE
Last modified: August 21, 2016

---

# Parse error: syntax error, unexpected T_ENDWHILE

 *  Resolved [gfewjf](https://wordpress.org/support/users/gfewjf/)
 * (@gfewjf)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_endwhile-10/)
 * When i want too view a plugin it says “Parse error: syntax error, unexpected 
   T_ENDWHILE in /home/cheapcon/cms/wp-content/themes/magic/single.php on line 11″…
   this is the code i wrote and i cant find the problem
 *     ```
       <?php get_header();?>
       <?php get_sidebar();?>
       <?php include ('sidebar2.php'); ?>
   
       <div id="left">
       <?php while(have_posts());?><?php while(have_posts());?>
   
       <H2><?php the_title();?></H2>
       <?php the_content();?>
   
       	<?php endwhile;?>
   
       	<?php comments_template('', true);?>
   
       </div>
   
       <?php get_footer();?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_endwhile-10/#post-4139980)
 * Try changing this:
 *     ```
       <?php while ( have_posts() );?><?php while ( have_posts() );?>
       ```
   
 * to this:
 *     ```
       <?php while ( have_posts() ) : the_post(); ?>
       ```
   
 *  Thread Starter [gfewjf](https://wordpress.org/support/users/gfewjf/)
 * (@gfewjf)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_endwhile-10/#post-4139981)
 * it didn’t fix much, but enough to do the rest by my own thank you 😉

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Parse error: syntax error, unexpected T_ENDWHILE’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [gfewjf](https://wordpress.org/support/users/gfewjf/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_endwhile-10/#post-4139981)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
