Title: Getting syntax error, unexpected T_ENDWHILE Error
Last modified: August 20, 2016

---

# Getting syntax error, unexpected T_ENDWHILE Error

 *  Resolved [decentguy49](https://wordpress.org/support/users/decentguy49/)
 * (@decentguy49)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/)
 * I am getting :-
    syntax error, unexpected T_ENDWHILE in /home/techn94c/public_html/
   wp-content/themes/TA/index.php on line 32 error on my website, here is my Index.
   php file copy :-
 *     ```
       <?php get_header(); ?>
   
           <div id="blog">
   
               <div class="post">
   
       		<div <?php post_class(); ?>>
   
       		<div class="post-date">
   
       <div class="month"><?php the_time('M') ?></div>
   
       <div class="day"><?php the_time('d') ?></div>
   
       </div>
   
       		<h1><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
   
                   <div class="entry">
   
                       <table><tr><td><?php the_excerpt(); ?></td><td><?php if ( has_post_thumbnail() ) {
   
       the_post_thumbnail();
   
       }
   
       elseif( catch_that_image() ) { ?>
   
       <img src="<?php echo catch_that_image(); ?>" width="64" height="64" alt="<?php the_title_attribute(); ?>" />
   
       <?php } else { ?>
   
       <img src="http://www.technoarea.in/wp-content/themes/TA/images/TA_Logo.png" width="64" height="64" alt="<?php the_title_attribute(); ?>" />
   
       <?php } ?>
   
       </td></tr></table>
   
                       <div class="cleared"></div>
   
                   </div>
   
               </div>
   
       		</div>
   
       <?php endwhile; ?>
   
               <center><?php if (function_exists("pagination")) {
   
           pagination($additional_loop->max_num_pages);
   
       } ?></center>
   
               <?php endif; ?>
   
           </div>
   
       <?php get_sidebar(); ?>
   
       <?php get_footer(); ?>
       ```
   
 * plz help as soon as possible

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

 *  [Chandan Kumar](https://wordpress.org/support/users/chandanonline4u/)
 * (@chandanonline4u)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016175)
 * Comment “endwhile” and “endif” in your code because you are ending statement 
   without starting it.
 *  Thread Starter [decentguy49](https://wordpress.org/support/users/decentguy49/)
 * (@decentguy49)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016177)
 * plz tell me which statement ur taking about and what should i put there
 *  [Chandan Kumar](https://wordpress.org/support/users/chandanonline4u/)
 * (@chandanonline4u)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016180)
 * Search “endwhile;” and “endif;” and comment (//) them as follows in your code:
 *     ```
       <?php //endwhile; ?>
       <?php //endif; ?>
       ```
   
 *  Thread Starter [decentguy49](https://wordpress.org/support/users/decentguy49/)
 * (@decentguy49)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016182)
 * thnkx for your support but nw web site showing 1 post on a page :- see here [http://www.technoarea.in](http://www.technoarea.in)
 *  [Chandan Kumar](https://wordpress.org/support/users/chandanonline4u/)
 * (@chandanonline4u)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016187)
 * 1. Add the following code just after get_header() function:
 *     ```
       <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
       ```
   
 * 2. Uncomment endwhile and endif as it was earlier.
 *  Thread Starter [decentguy49](https://wordpress.org/support/users/decentguy49/)
 * (@decentguy49)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016189)
 * nw whole theme seems unstyled
 *  [Chandan Kumar](https://wordpress.org/support/users/chandanonline4u/)
 * (@chandanonline4u)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016190)
 * I just checked your site and one extra div is closing just before “endwhile” 
   and it is causing unstyle. So remove one “</div>” tag just before “endwhile”.
 *  Thread Starter [decentguy49](https://wordpress.org/support/users/decentguy49/)
 * (@decentguy49)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016193)
 * did but not work
 *  [Chandan Kumar](https://wordpress.org/support/users/chandanonline4u/)
 * (@chandanonline4u)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016195)
 * I have written your whole code with modification, please check the following:
 *     ```
       <?php get_header(); ?>
       <div id="blog">
       <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
       	<div class="post">
       		<div <?php post_class(); ?>>
       		<div class="post-date">
       			<div class="month"><?php the_time('M') ?></div>
       			<div class="day"><?php the_time('d') ?></div>
       		</div>
   
       		<h1><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
       		<div class="entry">
       			<table><tr><td><?php the_excerpt(); ?></td><td><?php if ( has_post_thumbnail() ) {
       				the_post_thumbnail();
       				} elseif( catch_that_image() ) { ?>
       					<img src="<?php echo catch_that_image(); ?>" width="64" height="64" alt="<?php the_title_attribute(); ?>" />
       				<?php } else { ?>
       					<img src="http://www.technoarea.in/wp-content/themes/TA/images/TA_Logo.png" width="64" height="64" alt="<?php the_title_attribute(); ?>" />
       				<?php } ?>
       			</td></tr></table>
       			<div class="cleared"></div>
       		</div>
       	</div>
       <?php endwhile; ?>
       <center><?php if (function_exists("pagination")) {
       	pagination($additional_loop->max_num_pages);
       } ?></center>
       <?php endif; ?>
       </div>
       <?php get_sidebar(); ?>
       <?php get_footer(); ?>
       ```
   
 *  Thread Starter [decentguy49](https://wordpress.org/support/users/decentguy49/)
 * (@decentguy49)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016197)
 * its working dont know what i did but now its working anyways thanx
 *  [Chandan Kumar](https://wordpress.org/support/users/chandanonline4u/)
 * (@chandanonline4u)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016199)
 * Please mark the issue as resolved.
 *  Thread Starter [decentguy49](https://wordpress.org/support/users/decentguy49/)
 * (@decentguy49)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016208)
 * did
 *  [Chandan Kumar](https://wordpress.org/support/users/chandanonline4u/)
 * (@chandanonline4u)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016209)
 * Thanks

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

The topic ‘Getting syntax error, unexpected T_ENDWHILE Error’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 13 replies
 * 2 participants
 * Last reply from: [Chandan Kumar](https://wordpress.org/support/users/chandanonline4u/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/getting-syntax-error-unexpected-t_endwhile-error/#post-3016209)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
