Custom Widget Areas

Widgets are one if the great features of WordPress. They allow people to easily drag and drop to add different elements to their websites. Any web developer that knows what they are doing can accomplish these same functions without using widgets. It’s a simply a matter of adding the necessary elements to the theme files (which of course should always be in a child theme). However there are a couple of reasons why it may be a better idea to create a custom widget area instead of adding the elements directly to the theme.

The first reason is so that your clients can add, remove, or edit content themselves. The decision to allow this can differer depending on your client and business model. Some web design companies may choose to make things more difficult for their clients in order to force them to pay for additional work instead of doing it themselves. However most companies that I am familiar with choose WordPress expressly for the purpose of allowing clients to be able to make simple edit on their own. In this case adding a widget area can accomplish this by making it easy for people with no development skills to be able to add and remove these types of elements.

For example I had one project where the client wanted a small carousel slider added near the bottom of one page. Above the footer but below the content. It only took me 2 or 3 minutes to add a single line of code to the footer.php file to place this directly above the existing footer. But by creating a custom widget area there instead I was able to allow the client to switch to one of their other sliders or to add additional content there. Or if they wanted to remove this custom built area then it was a simple matter for them. If I had left the code in the theme file then the client would have never been able to do this on their own.

Another reason you might add a custom widget area is for your own convenience. I know php and have a lot of experience customizing WordPress themes to get just the right look. Much of my work involves adding extra content areas to headers, footers etc… But just for example because I can go into the header.php and add a phone number to display in a spot that isn’t supported by the theme doesn’t mean that it is the most efficient use of my time. Typically it is quicker for me to add something one time then it is to actually create a custom widget area. However if I have to frequently go back and edit the content then I save time in the long run by just creating a custom widget area and adding the content through a widget instead of going back into the theme files for every minor update.

Adding custom widget areas to allow elements to be displayed in places not normally supported by that particular WordPress theme is a tool that should be in every web developers tool box.


, , ,