O'Reilly logo

WordPress 3 Complete by April Hodge Silver

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 know as widgetizing your theme). Widgetizing is actually pretty easy, and involves just the following three steps:

  1. Ensure that your sidebar is one big, unordered list.
  2. Add a functions.php file with a special function in it.
  3. Add conditional code to your sidebar.

Nearly all of the PHP code you need to add in steps 2 and 3 can be pasted from already existing files, so the non-programmers out there shouldn't be too intimidated! Let's get started.

Making sure your sidebar is one big <ul> tag

This is actually not a requirement, but it's becoming the standard for WordPress sidebars among the theme-writing community. ...

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