[one_third last=”no”][/one_third]Wordpress is a wonderful thing.

We have just embarked on implementing our own company blog and as such have downloaded, installed and configured WordPress on our web server. As we use PHP on a number of our other sites and online tools, the rollout of  WordPress was a snap. Of course, we are endeavoring to give our blog a slicker look beyond that of the default themes that come bundled with WordPress. To achieve this we have brought in the fine folks at Template Monster. For a small price, we at Penad can roll out some very exciting looks to our blog.

We selected and purchased a few themes that we deemed to be rather slick looking and a good fit to our company. WordPress makes it so easy to apply themes and I happily embarked in doing so with the first of three that we downloaded. To my surprise I was greeted with an ugly error message:

PHP Parse error, unexpected ‘}’ in F:\IISites\blog.penad.ca\wp-content\themes636\functions.php on line 69

Being one that writes PHP code myself, I immediately opened the file with the thought that I could correct what was probably a syntax error in the file. Of course all the while thinking “hmmm, this is a package we paid for, not a free download, surely they wouldn’t sell a theme with broken code would they?”

Well, I was partly right and mostly wrong, if that is possible. As it turns out the syntax in the file was quite correct, namely any code associated with the closing ‘}’ bracket. No issues there. Upon a further look I had noticed that there were several opening and closing PHP blocks in the file mixed in with HTML. The opening tags for PHP in this file were the short tags (<?) and not the long tag (<?php).

In older versions of PHP, the short tag is generally an acceptable way to begin a block of PHP code. However, by default, newer installations come configured to allow for long tags only. Short tags are not good because they can conflict with the opening tag for xml as an example: <?xml.

It is possible to configure the PHP server installation to allow for short tags, but I prefer to leave this part of the default installation alone.

I proceeded to check all the other PHP files bundled with the theme and noticed that they all used proper long PHP opening tags. Functions.php is the only file with the short ones.

The solution was to replace all the <? tags in the functions.php file with <?php tags. Once the edited file was saved, I went back into WordPress and tried to set the theme again. This time I was not greeted with an ugly error, but a fully working theme.

Until this problem is resolved, a search and replace in any good text editor will do the trick.