Often a client wants us to change things on a live site, and whilst sometimes those changes are fairly minor, there are times where you’re making fairly substantial changes to a part of the site. I’m not talking about such huge changes that justify running a theme switcher or making a local copy of the site, but, well you get the idea.
Anyway, add this simple function to your functions.php file and then all you need to do is add ?devel to the URL to see changes.
/** * Page testing function, returns true if ?devel in URL * * @return BOOL Returns true if ?devel in URL */ function pa_devel() { if (isset($_GET['devel'])) { return TRUE; } else { return FALSE; } }
You can use this in your code by doing something like:
<?php if (pa_devel()){ ?> // do stuff for development <?php } else { ?> // show the normal live site code <?php } ?>
Comments