Title: Parse error: syntax error, unexpected T_ELSE
Last modified: August 20, 2016

---

# Parse error: syntax error, unexpected T_ELSE

 *  [Hallowtipz](https://wordpress.org/support/users/hallowtipz/)
 * (@hallowtipz)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_else-7/)
 * Hello guys i just edited out a some lines on code, the page results keeps giving
   me:
 * Parse error: syntax error, unexpected T_ELSE in /home/content/m/e/n/mensah/html/
   bestpricegh/wp-content/themes/kassyopea/wpsc-single_product.php on line 54
    THIS
   IS THE CODE
 *     ```
       while ( wpsc_have_products() ) : wpsc_the_product(); ?>
   
       						<div class="textcol">	
   
       										<?php
       										if ( function_exists( 'gold_shpcrt_display_gallery' ) ) :
       											echo gold_shpcrt_display_gallery( wpsc_the_product_id() );
   
       											if ( get_option( 'show_gallery' ) ) :
       											?>
       											<style type="text/css">
       	.wpcart_gallery img {
       ```
   
 * _[Moderator Note: Please post code or markup snippets between backticks or use
   the code button. Or better still – use the [pastebin](http://wordpress.pastebin.com/)]_

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

 *  [wpismypuppet](https://wordpress.org/support/users/wordpressismypuppet/)
 * (@wordpressismypuppet)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_else-7/#post-2886630)
 * If this is all the code for the page, it’s really messed up 🙂 You are getting
   that error message, in this case, because you have two if statements, one right
   after the other, without either ending the first if, or putting an else. You 
   have:
 *     ```
       <?php
       	if ( function_exists( 'gold_shpcrt_display_gallery' ) ) :
       		echo gold_shpcrt_display_gallery( wpsc_the_product_id() );
       	if ( get_option( 'show_gallery' ) ) :
       ?>
       ```
   
 * When it should be something more like:
 *     ```
       <?php
       	if ( function_exists( 'gold_shpcrt_display_gallery' ) ) :
       		echo gold_shpcrt_display_gallery( wpsc_the_product_id() );
       	endif;
       	if ( get_option( 'show_gallery' ) ) :
       ?>
       ```
   
 * Or if you need an else for whatever reason:
 *     ```
       <?php
       	if ( function_exists( 'gold_shpcrt_display_gallery' ) ) :
       		echo gold_shpcrt_display_gallery( wpsc_the_product_id() );
       	else if ( get_option( 'show_gallery' ) ) :
       ?>
       ```
   
 * If, Else, While and other conditional comments need to be closed. If you use :
   to start them, you need endif; or endwhile;. If you use open curly brackets {
   you need to close the curly bracket }
 *  [wpismypuppet](https://wordpress.org/support/users/wordpressismypuppet/)
 * (@wordpressismypuppet)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_else-7/#post-2886632)
 * Keep in mind you might be closing them further down the page, but this is the
   only code you gave us, so it’s what we have to work with… if you want to paste
   all the code for the entire page, I could give you better results.

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

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

## Tags

 * [parse-error](https://wordpress.org/support/topic-tag/parse-error/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [wpismypuppet](https://wordpress.org/support/users/wordpressismypuppet/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_else-7/#post-2886632)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
