Parse error when updating functions.php

This topic contains 10 replies, has 3 voices, and was last updated by  Paolo 9 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #50226

    adyp
    Expired Member
    Post count: 496

    Hello,

    I have been experimenting with dropping in snippets of code (as suggested on various websites) to my theme’s (GDF Modern child) functions.php in order to have the admin bar appear only to me as admin (currently all visitors to the site get to see the admin bar – none of my other wordpress sites display this behaviour) – none of them have been successful – anyway that’s not the pressing problem!

    After trying the latest variation I was unable to to update the functions.php file, getting the error:

    Parse error: syntax error, unexpected T_STRING in /home/[…]/wp-content/themes/geodir_gdf-modern/functions.php on line 94

    Not a php expert, I can’t see the problem, as I have only been dropping in and removing snippets at the end of the file – currently I have removed the snippet but am getting the error, meaning that I can’t move away from the functions.php editor screen in the backend!

    Here is the code that is currently at the end of the file, where there is apparently an error (I had been dropping in and removing snippets in the space before the error-reporting code at the end):

    function gdf_modern_action_wrapper_open() {
    if ( geodir_is_page(‘location’) || ( is_front_page() && get_option(‘geodir_set_as_home’) ) ) {
    echo ‘<div id=”geodir_wrapper” class=”gdf-modern-home”>’;
    } else {
    echo ‘<div id=”geodir_wrapper”>’;
    }
    }

    error_reporting(E_ERROR);
    ?>

    Any ideas as to what the problem is?

    Thanks

    #50229

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    It’s hard to tell without seeing the whole file. can u link to a pasetbin of it or something.

    Thanks,

    Stiofan

    #50232

    adyp
    Expired Member
    Post count: 496

    Never heard of a pastebin before – learnt something!

    Is this what you want: http://pastebin.com/V7Ex8ddg

    Thanks,
    Adrian

    #50236

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Adrian,

    I don’t see anything obvious, infact your error seems to refer to a line that does not exist?

    Stiofan

    #50238

    adyp
    Expired Member
    Post count: 496

    Yes,

    it’s a little perplexing to say the least.

    I am worried that if I navigate away from the page – or log out – I may not be able to get back in.

    I’ll have to try anyway!

    Thanks for looking.

    Adrian

    #50242

    adyp
    Expired Member
    Post count: 496

    I can’t appear to navigate away from the back-end functions.php editor page now – not even to log out!

    Any advice/

    #50252

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Try making changes via FTP.

    Stiofan

    #50255

    adyp
    Expired Member
    Post count: 496

    I am not sure I am set up for that – before I look into it, can I instead edit the file through my control panel editor? (although when I opened the file it opened a file called functions-1.php, then functions-2.php). I am guessing I have to log out of my wordpress site or otherwise close that file/page before I can access the original file via control panel?

    Thanks, I realise this doesn’t appear to be geodirectory issue – your help is appreciated!

    Adrian

    #50258

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You could edit it via your control panel, the system only looks at the functions.php so if it’s renamed to something else then it wont look at that.

    Stiofan

    #50279

    adyp
    Expired Member
    Post count: 496

    hi Stiofan,

    all fixed.

    I managed to open functions.php in code editor through Control Panel – strangely enough, the file contained the last snippet that I had tried, and which apparently had an error on line 94 – although I had deleted that snippet as far as wordpress backend was concerned and so 94 was off the end of the file! Sniped deleted and now all ok.

    When I had tried opening the file in Control Panel file manager by double clicking and selecting gedit to edit it seemed to be opening a copy of the file, hence ‘functions-1.php’ etc. Now I know to open using the correct code editor.

    Thanks for looking at this anyway.

    Adrian

    #50331

    Paolo
    Site Admin
    Post count: 31211

    Thank you for letting us know! 🙂

Viewing 11 posts - 1 through 11 (of 11 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount