What I Hated the Least Today 190/365: functions.php

What I Hated the Least Today 190/365: functions.php

Don't. Just don't.
Don’t. Just don’t.

The following applies to self-hosted WordPress sites and is of zero interest to WordPress-hosted bloggers. Or simply, it’s of zero interest. It needs to be however recorded as a cautionary tale. I’ll start with the moral: PHP is different from PhD and having the latter doesn’t mean you qualify to mess with the former. Unless you like a challenge, like me. And unless you don’t mind taking your site down, unlike me.

I’m working on a site for a particularly annoying customer who earns ridiculous money on providing human resources consulting. It’s weird how come that I think so little of such vaguely defined, immaterial and probably unproductive jobs, considering that I’m trained in English Literature. What’s more vaguely defined, immaterial and unproductive than literary research? (That wasn’t a real question, that was a statement in disguise.)

I CSSed the shit out of her site because I enjoy cascading. I can’t cascade really, but I don’t consider it an obstacle to trying. On which the lady tells me that she basically wants a 1990s style static site with white background and black text. Hm. I could probably even do this in HTML from scratch. The lady however insists on being able to edit the texts herself, hence it needs to be WordPress and it needs to be in Czech. (*sigh*)

Czech WordPress is semi-translated, which means that for some sections of the site to display in Czech, I need to translate manually. Reiterating old news, the wrong way is to edit the files of the theme directly as all changes are lost when the theme is updated to a new version. The right way is to create a child theme and edit the child theme files. So far, so good, except when it comes to functions.php.

I was unreasonably encouraged by my success in editing footer.php—of course, it took multiple attempts, but wrong code didn’t take the whole site down, only the footer didn’t display—so I thought I’d try to modify the functions file. I broke it at the first try. Took the entire site down. Parse error. Couldn’t fix it (of course). Locked me out of WordPress admin too. My unadvised and unqualified effort to crack this was quite hilarious. I was even having fun, in a way, because I like a challenge.

I exchanged some emails with a very unsupportive support of my domain and hosting provider, who advised me to try to restore the backup of the site and sent me a link to a manual saying: “In our admin area, export the MySQL database backup and then import it via phpMyAdmin.” Full stop. Not too detailed. I tried and failed (of course). I resisted the temptation to complain via the link that came with each email from the support and asked me to evaluate my support experience.

In retrospect, I think they should probably have told me to go to the FTP client in the first place and try deleting the offending child theme file. Based on what I Googled, this might have been the elegant solution. Well, I went inelegant, and I helped myself—I located Delete Database and Install WordPress options in my hosting admin area, I checked with support that this would help, and simply deleted and reinstalled the whole thing. It did help.

Sure, I ended up with a fresh WordPress install and it took me two hours to set the settings again and import the content again from my various dumb backup files (dumb because I’m pretty sure you don’t save website texts in .docx files and code in .txt files on your computer in lieu of a backup), but I did it on my own, without help. Which I didn’t hate at all. I mean, better than waiting several days for support to fix it for me and paying them for it. Also, be warned: hide your kids, wives and sites, I’m recuperating and considering further ventures into functions.php. I haven’t had enough.

20 thoughts on “What I Hated the Least Today 190/365: functions.php

  1. That’s pretty impressive, the things you’re able to do! 😀
    You’ve learnt so much in so little time!
    And upon clicking I found it weird that the layout was in Czech, as you’re always so ”British”. But I figured out the reason as I read through.


    1. Awe, thank you! I’m trying to be disciplined and learn code in an organised manner from the W3Schools website. It’s a brilliant resource. I enjoy my learning experience, even though I very often break things in the process.

      You know me too well, no way would I voluntarily switch to Czech as long as English is an option. It also makes sense. We don’t make things here, we import and translate them, and I can’t see why I should bother with an inevitably imperfect translation when I can understand the original. A shame English is the only second language I know though.

      Thanks for reading and keep on enjoying your summer break!


  2. I love reading about people who love what they do even when I have little idea of what they are doing but the enjoyment and thrill of it all you convey so perfectly I was beginning to think you may have actually been enjoying yourself.

    Liked by 1 person

    1. Thank you for your kind comment! I have no idea what I’m doing, however, I’m enjoying myself immensely when doing it. I might have graduated from the wrong discipline (no conditional here really, I did graduate from the wrong discipline), but the least I learned is to keep on learning all the time. Now, one thing that remains to figure out is how to avoid forgetting things. All the time.

      Liked by 1 person

  3. I know this can be exhilarating and “fun” in a bizarre way. However; I’ve never done it for anybody else — only myself. If my little, insignificant website goes down; no big deal (even if it feels as if the world stops turning). To do this for a business, would scare the shit out of me.

    The times I’ve been into the .php, I’ve only copied and pasted … not trying to do anything on my own. I’m scared of .php because I don’t understand anything.

    The times my page has gone down, I’ve always been able to go in, via my host, and delete the folder, except once. Can’t recall now, what had happened, but I actually had to call up GoDaddy, and they did it for me.

    Regardless of everything … isn’t it amazing, all the stuff you learn, and quickly, when you’re doing this stuff! I always felt a little proud of myself afterwards!


    1. I didn’t do this on a production site that would be up and running – it’s a newly set up domain and a new site. So nothing much happened.

      PHP used to freak me out because I have absolutely no clue what is going on in there, but the more I poke around in things, the less I’m afraid of them. I didn’t of course attempt to write PHP, I copied and pasted, but apparently that was enough to break it. I’ll be definitely doing more of this on my test site. It bugs me…

      A week ago, I started a little private project, Code a Day, when each day I learn a bit from the W3Schools site. I take my study notes in HTML and I always feel so awesome when I look at my “work”. I’ll be sharing my “project” at some point, though there’s nothing to see in it. Just notes, codes and experiments.

      Liked by 2 people

      1. Yeah, it takes so little, when one does the pasting …

        What a terrific idea! Looking forward to seeing it. Great way to go about it too — that’s what one should’ve done in the beginning.

        Liked by 2 people

        1. Whew, the Code Academy looks quite fancy! I probably won’t switch to them now, I’m used to the simplicity of W3Schools and the way they structure their courses, but I’m very likely to try it out as an alternative at some point, for revising and practising. Thanks a lot for the link!

          Liked by 3 people

Say what?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.