O'Reilly logo

WordPress 3.7 Complete Third Edition by Aaron Hodge Silver, Karol Król

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

  1. Go back to your "static" sidebar.
  2. Add some specific functions to the functions.php file.
  3. 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required