Making your theme widget friendly
If you want to be able to use the widgets in your theme, you will need to make your theme widget friendly (also known as widgetizing your theme). Widgetizing is actually pretty easy, and involves just the following three steps:
Go back to your "static" sidebar.
Add some specific functions to the
functions.php
file.Add conditional code to your sidebar.
Nearly all the PHP code you need to add in steps 2 and 3 can be pasted from already existing files, so the nonprogrammers out there shouldn't be too intimidated! Let's get started.
Going back to our "static" sidebar
The use of quotation marks probably makes you wonder what this is all about. The fact is that even though we have a sidebar at this stage, which is a static one, we're only using it as a placeholder—content that's going to be replaced with our dynamic widgets. In its final form, the static sidebar content will only be used if no widgets are selected in Appearance | Widgets.
This is actually not a requirement...