Title: Parse error: syntax error, unexpected T_ENDWHILE, not the same old error
Last modified: August 20, 2016

---

# Parse error: syntax error, unexpected T_ENDWHILE, not the same old error

 *  [cyanophycean314](https://wordpress.org/support/users/cyanophycean314/)
 * (@cyanophycean314)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_endwhile-not-the-same-old-error/)
 * I’m getting the ‘Parse error: syntax error, unexpected T_ENDWHILE’ error. The
   only problem is that it says that it’s in the first line of my code, which is:
   `
   <?php get_header();`
 * I’ve looked at the other topics with this problem, but they have extra brackets.
   This seems odd.

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

 *  [David Choi](https://wordpress.org/support/users/wpthemes777/)
 * (@wpthemes777)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_endwhile-not-the-same-old-error/#post-2978345)
 * Mabye it’s not close properly? Like:
 * <?php get_header(); ?>
 * but it depends on the following codes…
 * but it’s possible the problem lies elsewhere, in a while() loop.
 *  Thread Starter [cyanophycean314](https://wordpress.org/support/users/cyanophycean314/)
 * (@cyanophycean314)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_endwhile-not-the-same-old-error/#post-2978347)
 * No, using notepad++ I can see where all the tags end and they’re all correct.
 * If it helps, this is the first chunk of code.
 *     ```
       <?php get_header();
       	$author = get_the_title();
       	function parseToStaffPage($name) {
       		$name = strtolower(str_replace(" ","-",$name)); //Switches the space to a hyphen and lowercases everything.
       		return "staff/".$name; //Adds the rest of the URL on
       	}
       ?>
       ```
   
 *  [David Choi](https://wordpress.org/support/users/wpthemes777/)
 * (@wpthemes777)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_endwhile-not-the-same-old-error/#post-2978349)
 * This code is fine, it’s just kind weird you would call
 * get_header();
 * because it will insert the header.php file. So maybe the problem is in the header.
   php file (you didn’t post the complete error message).
 * And by the way, to use
 * get_the_title();
 * it needs to be in a loop (the caller). Or else, you have to provide the post 
   ID, something like
 * $author = get_the_title($ID);
 * so it is possible that the logic was not implemented correctly (just guessing).

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

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

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [David Choi](https://wordpress.org/support/users/wpthemes777/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_endwhile-not-the-same-old-error/#post-2978349)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
