Community Forums › Forums › Archived Forums › General Discussion › Unable to edit functions.php
Tagged: unable to edit functions.php
- This topic has 22 replies, 5 voices, and was last updated 9 years, 4 months ago by Gemini55.
-
AuthorPosts
-
December 8, 2014 at 3:29 am #133963Gemini55Participant
I have genesis and copyblogger 2 theme
I had this issue a few months ago and it happened again yesterday when trying to edit the functions.php file.
Basically I am unable to edit the functions.php file.
If I try to edit it and update the file - the edit fails and it crashes the whole website leaving a 'white space' - and the only way to rectify the problem is to do a complete backup from a previous time.
I am sure the functions.php should be editable - can you advise what the problem could be and how to resolve it?
https://www.londontheatre1.comDecember 8, 2014 at 5:10 am #133971Pixel FrauMemberIs WordPress crashing while saving the edited file, or is the site not working after you've made changes and saved functions.php? If you've entered code incorrectly in functions.php, it often results in the site not working or coming up as a blank white page.
I'd suggest editing the file via FTP. Download the existing functions.php file. Open the file in a text editor on your computer and make the changes. Then upload the revised file via FTP.
December 8, 2014 at 10:16 am #133989Gemini55ParticipantThe small snippet of code I added shouldn't have made any real difference... but once the file is saved it crashes everything and I am then unable to access the functions.php to remove or edit again - in fact unable via wordpress login to access anything.
I haven't tried it but I think if I were to simply save the functions.php without adding anything it would probably crash everything.
December 8, 2014 at 10:35 am #133991Pixel FrauMemberJust one wrong or missing character in functions.php can crash a site. Since you are able to save the changes in functions.php, but not access the site after saving, I would guess that there is an error in the code you're adding. Why don't you paste it here so people can take a look for you.
December 8, 2014 at 11:29 am #133994Gemini55ParticipantHi, it is not so much that it crashes the website it is the subsequent inability to put the functions.php back to how it was and restore everything.
The code that was added was from http://my.studiopress.com/snippets/post-meta/
<?php
//* Do NOT include the opening php tag//* Remove the post meta function
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );December 8, 2014 at 11:44 am #133995zubirdMemberDid you remove the opening <? php tag as the comment suggests?
Add this to the functions.php file:
//* Remove the post meta function
remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ );Not this:
<?php
//* Do NOT include the opening php tag//* Remove the post meta function
remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ );Also, if you are editing through WP, you can sometimes hit your back button, remove the offending code and save it again to restore it. Or, if you are using ftp or an application like Dreamweaver, simply remove the offending code, then upload that functions file again. Refresh your browser and you should be back in business.
In other words, you should not have to do a complete restore, just restore the functions.php file.
December 8, 2014 at 11:51 am #133996Gemini55ParticipantThis is what was added:
//* Remove the post meta function
remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ )December 8, 2014 at 12:07 pm #133997Pixel FrauMemberIt's missing the semicolon on the end.
December 8, 2014 at 12:13 pm #133998Gemini55Participantsorry that was my copying and pasting into here:
The following was added:
//* Remove the post meta function
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );My point is not so much that whatever code is added it is the subsequent crashing and being unable to rectify it. ie. unable to remove any code and save as it was before. I have never known this before with a functions.php
I haven't tried it but I wonder if it would crash simply by clicking on the update button - I am VERY reluctant to do this as it would crash the site again.
December 8, 2014 at 6:30 pm #134033marybaumParticipantI believe you have a plugin conflict.
I cannot urge you strongly enough to take Julia's advice about editing code on your local machine and then uploading it with FTP - she or I can help you set up a local environment for that, or you can just use a text editor (TextEdit or NotePad, depending) and an FTP client (there are lots of perfectly good free ones.)
To find your problem, we do what I call The Dance. Other folks call in a binary something-something, but I've been calling it The Dance for nigh-on 30 years -- we used to use it to fix problems with Macs, back in the day.
But first, you need that FTP client - and the FTP credentials to log in to your site. Those are probably in the email you got when you bought your hosting, assuming you did. If you had a developer or a relative do it, ask that person for that info.
(Keep it in a safe place. My veterinarian didn't have his, then his developer died. The hosting co is not exactly helping.)
This is important, because the only way to fix your problem is to reproduce it on purpose.
The basic process, then, is this - you'll log in to your site via FTP and see a list of folders - in the one called wp-content, there will be a folder called plugins.
You will create a new folder called Old Plugins, then move half the plugins from the Plugins folder into the Old Plugins folder.
Now log in to your back end as usual and try to edit something in your editor window. If everything is wonderful, you know the offending plugin is in the bunch you just removed. If the site crashes, you know the problem is in the half that are still active.
Now take half the plugins in whichever folder has the problem and add it to the folder that probably doesn't - repeat the process.
Eventually you should get down to a single plugin that you know is the bad one. Nuke it and find a replacement if you need whatever it does.
Hope that helps!
Sharing the good news about the wonders of modern CSS and the split-step. Either one should get you moving fast. 😀
December 8, 2014 at 7:17 pm #134035Gemini55ParticipantBrilliant Mary - that makes sense Many many thanls! 🙂
I am on to it and am setting up a local installation 🙂
I have all ftp settings etc.
December 10, 2014 at 7:55 am #134159Gemini55ParticipantI am trying to set up WordPress and theme on my 'local' computer but seem to be having a problem adding functions.php file to new theme folder...
I have downloaded Genesis and installed wordpress - no problem and all works
I create new theme folder and name it.... and also add an image to it.. and copy original style sheet across and teh theme appears in the Themes section of wordpress no problem...
Question: What other files do I need to add in the new theme folder? (if any)
I think it is the functions.php -
I have tried copying the functions.php and and when I do that cause a problem... I get a 'white screen' and only when I remove the functions.php from the new theme folder does it all work again
Question: Should I add the functions.php to the new theme folder or not? And IF so How?
December 10, 2014 at 8:12 am #134162Pixel FrauMemberIf you're following Mary's advice, you'll want to copy everything from the theme folder.
December 10, 2014 at 8:33 am #134165Gemini55ParticipantI have tried that Pixel but the theme just crashes.... when I go to view a post for example... in fact I cannot even login (white screen)
If I copy EVERYTHING from the genesis folder into new theme folder I cannot even login on the WP panel... but as soon as I remove the functions.php I am able to...
December 10, 2014 at 8:35 am #134166Pixel FrauMemberAnd have you renamed the plugins folder like Mary suggested?
December 10, 2014 at 9:23 am #134190Gemini55ParticipantI am doing this on a fresh local install so there are no plugins...
December 10, 2014 at 9:28 am #134191Pixel FrauMemberThen there must be something wrong with the code in functions.php. Try using the original theme files.
December 10, 2014 at 9:30 am #134192Gemini55ParticipantI am...
December 10, 2014 at 9:38 am #134194Pixel FrauMemberFrom what you've said, it sounds like you've copied the theme as is from your existing installation. You've also said that you've made some changes to it.
So try installing the original theme—as directly downloaded from StudioPress.
December 10, 2014 at 9:51 am #134197Gemini55ParticipantI have downloaded directly from Studiopress - files directly on to my computer - simply trying to get its started and create a child theme...
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.