Show widget location borders for development

If your theme is any good, no code at all will be rendered for empty widget areas, so if you want them all to show, you must populate them.

There are off course browser tools that will highlight widget areas, but they will only show one at a time, while you presumably want an overview of all areas on your site. There’s no built in method for this, but it’s not difficult to make.

Since this is only temporary you can be forgiven for adding a line to the header.php file just before the <body> tag, where you should see a statement body_class($variable). Here you include:

if (current_user_can('edit_themes')) $variable .= " widget-borders".

Effectively this adds the class ‘widget-borders’ to the body. Then, in the code, find the class that is used for widget areas, let’s say “my-widget”. Now you have enough information to target widget areas just for admins with css, by adding this line to style.css:

body.widget-borders .my-widget {border:2px solid red;}