• Resolved vik92sandhu

    (@vik92sandhu)


    I was removing a signature function out of my functions.php of my lightworld theme. When I hit update I got this
    Parse error: syntax error, unexpected ‘<‘ in /hermes/bosweb/web031/b310/ipg.droidlabsca/wp-content/themes/lightword/functions.php on line 9

    here is the area that I was editing, does anything seem wrong?

    <?php
    if (!empty($_SERVER[‘SCRIPT_FILENAME’]) && ‘functions.php’ == basename($_SERVER[‘SCRIPT_FILENAME’]))
    die (‘Please do not load this page directly. Thanks!’);

    $themename = “LightWord”;
    $shortname = “lw”;
    $top_header_image_path = get_template_directory_uri().”/images/header-image.png”;

    (((((I PLACE IT HERE)

    if ( ! isset( $content_width ) ) $content_width = 550;

    $options = array (

    array( “name” => “Welcome”,
    “type” => “title”),

Viewing 5 replies - 1 through 5 (of 5 total)
  • Was it where the above code says (((((place it here) ? Looks like that is line 9

    If it is html you would need to close out php tag before the html and then reopen the php tag after the html.

    Thread Starter vik92sandhu

    (@vik92sandhu)

    (((((PLACED IT HERE)))) thats where I added my own code but now have deleted it. the ((((PLACE It HERE))))) is not actually in the code.

    hmm… well, what ever is on line 9 or possibly line 8 or 10 (sometimes the error is actually right before or right after the line number the error gives). But I would interpret this error as there is a ‘<‘ on that line that shouldn’t be there. It’s hard to tell if the function you are removing has some other code elsewhere that is inserting an opening tag or something.

    Normally the above error would be caused by something like this

    <?php
    //some php code
    <div>or some other html tags</div>
    //more php code
    ?>

    which should be

    <?php
    //some php code
    ?>
    
    <div>or some other html tags</div>
    
    <?php
    //more php code
    ?>

    Notice the closing and opening php tags that keep php from trying to parse the html as php. Without them it would imediately throw the error on the first ‘<‘.

    Thread Starter vik92sandhu

    (@vik92sandhu)

    Hey thanks guys, I managed to resolve the issue by analyzing the file in greater depth and finding some bad html. Thanks a ton for your help its much appreciated.

    No problem. Glad you found the issue.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘syntax error’ is closed to new replies.