Thanks, Jemmy, for taking the time to share your code. You have an impressive profile—unfortunately, the code, when added to my funtions.php, throws up a few errors.
Parse error: syntax error, unexpected '(', expecting variable (T_VARIABLE) or '{' or '$'