Support » Themes and Templates » Parse error: syntax error, unexpected '

  • Resolved Swagata Das


    Greetings all, currently making a theme when testing it, getting an error Parse error: syntax error, unexpected '<' in C:\wamp\www\wordpress\wp-content\themes\wppro\header.php on line 25. But on line 25 I have <?php wp_head(); ?>. Why I’m getting this error? Isn’t the correct use of wp_head?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator cubecolour



    What do you have on the previous line?

    [ Moderator note: please wrap code in backticks or use the code button. Do not use blockquote it doesn’t work. ]

    <!DOCTYPE html>
    <html <?php language_attributes(); ?>>
        <meta charset="<?php bloginfo( 'charset' ); ?>" />
        <title><?php bloginfo( 'name' ); ?><?php wp_title(); ?></title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
    function wppro_script_enqueuer() {
    	//first we register the styles
    	wp_register_style( 'bootstrap', get_stylesheet_directory_uri().'/assets/css/bootstrap.css');
    	wp_register_style( 'bootstrap-responsive', get_stylesheet_directory_uri().'/assets/css/bootstrap-responsive.css');
    	wp_register_style( 'docs', get_stylesheet_directory_uri().'/assets/css/docs.css');
    	wp_register_style( 'prettify', get_stylesheet_directory_uri().'/assets/js/google-code-prettify/prettify.css');
        //now we enqueue them
        wp_enqueue_style( 'bootstrap' );
        wp_enqueue_style( 'bootstrap-responsive' );
        wp_enqueue_style( 'docs' );
        wp_enqueue_style( 'prettify' );
    add_action( 'wp_enqueue_scripts', 'wppro_script_enqueuer');
    <?php wp_head(); ?>
      <body <?php body_class(); ?> data-spy="scroll" data-target=".bs-docs-sidebar">
    Moderator cubecolour



    Try adding a new line after

    add_action( 'wp_enqueue_scripts', 'wppro_script_enqueuer');



    Thanks, it worked. Do I need to add a space after get_stylesheet_directory_uri() and before .'/my/directory/style.css?

    Moderator cubecolour



    No, it is not necessary, but I prefer to add a space before & after the . (string concatenation operator) to make the code easier to read

    Thanks for your help. Merry christmas.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Parse error: syntax error, unexpected '’ is closed to new replies.