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 TicketTagged: functions.php parse error
-
AuthorPosts
-
August 21, 2015 at 10:50 am #50226
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
August 21, 2015 at 10:58 am #50229It’s hard to tell without seeing the whole file. can u link to a pasetbin of it or something.
Thanks,
Stiofan
August 21, 2015 at 11:26 am #50232Never heard of a pastebin before – learnt something!
Is this what you want: http://pastebin.com/V7Ex8ddg
Thanks,
AdrianAugust 21, 2015 at 12:18 pm #50236Hi Adrian,
I don’t see anything obvious, infact your error seems to refer to a line that does not exist?
Stiofan
August 21, 2015 at 12:35 pm #50238Yes,
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
August 21, 2015 at 12:59 pm #50242I can’t appear to navigate away from the back-end functions.php editor page now – not even to log out!
Any advice/
August 21, 2015 at 1:18 pm #50252Try making changes via FTP.
Stiofan
August 21, 2015 at 1:28 pm #50255I 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
August 21, 2015 at 1:46 pm #50258You 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
August 21, 2015 at 2:43 pm #50279hi 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
August 21, 2015 at 7:29 pm #50331Thank you for letting us know! 🙂
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket