It was bound to happen, the very reliable Mesocolumn WordPress theme finally made an entry in a website’s fatal error logs.  I make a habit of examining website error logs, if you have a business with a web department, insist that they regularly scan and check your website error logs or subscribe to a service or has a script that can report 500 errors immediately.

Here was the error that cropped up:

[22-Apr-2016 09:27:05 UTC] PHP Fatal error: Call to undefined function get_theme_option() in /webroot/prolificfutility.com/public_html/wp-content/themes/mesocolumn-child/footer.php on line 119

500 server errors are never pleasant, it’s a fact of life if we don’t dedicate QA time to test, test and then test the sites again and again.  There is a point of diminishing returns of dedicating too much time to testing because that takes time away from web development, you know, actually creating coding solutions?!

Fixing WordPress 500 errors

This was an easy fix, because the error was easy to spot in the logs — get_theme_option function was undefined and there was a condition in the footer that called on it, so I simply wrapped the condition throwing the error first with this check:

if (function_exists('get_theme_options')) {
 // execute other code that was in the child theme here...

It’s not an ideal fix, but since I didn’t have time to investigate further, at least the page would continue loading if the get_theme_options() function was actually deprecated from the theme during a recent update.  It’s all about prioritizing your web development tasks to make sure you are optimizing your code production and in the context of other due dates, projects and considering the ROI of this task, it’s way down on the priority list.  So far down it will probably never be addressed since, truthfully, there are usually much more important and profitable web development tasks to perform.  Perhaps the next update it will fix itself, there’s no harm in doing an extra check to see if the function exists, even if they bring it back.

The more important benefit is that the page continues to load without throwing a fatal error, which is not only bad for SEO, it’s bad for the UX of every visitor and that’s always something that’s top on the priority list!


Good Git structure overview

Structuring your Git upfront can save you a lot of headaches with you and your team later.  Here’s an overview of a great article to help you get your team back to the basics and set a new baseline from which to start relying on Git more effectively as a team.

Git pull rebase explained by humans, for humans

Here are a couple of posts explaining pulling with rebase and the difference between merging and rebasing.  You may want to read them a few times and try them out on your on repositories to get the hand of the best time to rebase and merge.

http://gitready.com/advanced/2009/02/11/pull-with-rebase.html

https://www.atlassian.com/git/tutorials/merging-vs-rebasing/

Git Submodules explanations

http://julienrenaux.fr/2014/08/05/how-to-use-git-submodules-to-facilitate-your-development-routine/

https://confluence.atlassian.com/sourcetreekb/adding-a-submodule-subtree-with-sourcetree-785332086.html?continue=https%3A%2F%2Fconfluence.atlassian.com%2Fsourcetreekb%2Fadding-a-submodule-subtree-with-sourcetree-785332086.html&application=cac

Video:

https://www.youtube.com/watch?v=sabx_jxdzTQ&nohtml5=False

Git pruning branches explanation

Learn more about pruning your Git branches.  Here’s another good article here.

Git push

If Git couldn’t be more confusing with forcing a push, try this “safer” one:

git --force-with-lease

Here’s an explanation about “forcing with a lease” which sounds more like an early 20th century slum-lord tactic than something a web developer would have to do with their code repositories.

To remove any file matching  a wildcard, since many git command lines don’t support wildcards like the command line:

Where “error_log” is the file name or part of the file name:

find . -name error_log | xargs git rm -r 

Reverse and Stage Hunks

I couldn’t resist, after all, Source Tree has been helpful for many developers maintain and find their way around multiple projects with multiple repositories because it can be confusing if you are just using Git on the command line.  You may be too cool to not use Git on the command line, you have to keep up your street cred, but this just helps you see the forest and the trees faster than typing a bunch of git on the command line.  I have better things to do.

Atlassian provides a lot of help on there, site, click here to learn about “hunks” and you’ll also learn why Git is still growing and has a lot of room for improvement.


Here is a reference list to access global values within Twig:

For $_POST variables use this :

{{ app.request.parameter.get("page") }}

For $_GET variables use this :

{{ app.request.query.get("page") }}

For $_COOKIE variables use this :

{{ app.request.cookies.get("page") }}

For $_SESSION variables use this :

{{ app.request.session.get("page") }}

For more Symfony Twig shortcuts, view the Twig Cheatsheet with recent updates added, a perfect reference for Symfony web developers.


A special thanks to James Halsall for some excellent tips in tapping into Symfony events through kernel listeners.

His article explains how to create a service to trigger on certain events, this is related to the FOS User Bundle but the same pattern applies to most events in your Symfony project.  Click here to read the entire article with explanations and example code.


I added some new improvements to the “Insert Script” WordPress plug-in.  You can now declare a JSON string and it will parse it out as $json_vals_arr, an array that gets passed directly to your external PHP script.

You can also declare “strings” instead of “vals” as a GET URL string like:  “strings=’variable1=value1&variable2=value2&etc=andSoOn'”.

To download the most recent version, type in “Insert Script” and select the plug-in author “Aaron Belchamber”.  To learn more, visit the official Insert Script WordPress Plug-in Page.  This is a simple and clean way for WordPress PHP developers looking to integrate external scripts and content within a WordPress page, post, or widget.