• 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)
  • 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

    (@cyanophycean314)

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

    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.