How to Comment Code in WordPress Templates

I've spent a lot of the weekend working on a Vancouver real estate website which we converted to WordPress last year.

(Don't feel too sorry for me, the rest of the weekend I spent with my girlfriend.)

There were a bunch of issues in the PHP code which I couldn't solve myself so I had to leave my efforts there for the designer.

I was unable to comment it out with html comments (what I usually do). PHP comments wouldn't work either, so I put some serious research into how to comment PHP properly.

It turns out there is a simple but very effective trick:

<?php /*
*/ ?>

I recommend reading the full article on How to Comment Code in WordPress templates if commenting WordPress templates is something you need it do occasionally. It will save you a lot of time.

I am sure much of this applies to our friends over in Mambo/Joomla and Drupal land.

A tip of the hat to My Digital Life for his article - Comments and Comment Blocks in PHP.

This entry was posted in WordPress and tagged . Bookmark the permalink.

Leave a Reply