What Are WordPress Widgets

WordPress makes it easy to add content to certain parts of your website.
One way that this is made possible is through widgets

A widget is a piece of content you add to a part of a website page. These parts where you add content are termed widget areas. Widget areas can be sidebars, footers, headers, or below an article.

With widgets you can add literally any type of content;

  • Regular text
  • HTML content
  • Images
  • Shortcodes
  • Social media buttons

The new block widgets have made a wide range of content to add.

Why use widgets?

Widgets allow easy addition of content without going into the source code.
Widgets are applied to all the pages where they’re registered. You only write once.

Classic vs Block Widgets

WordPress has evolved and improved over the years. Classic (old) widgets used a traditional drag and drop functionality to add widgets. The widgets were pretty much limited compared to the new Block widgets.

Blocks are robust components (or sections) used in adding and editing text. These blocks can be moved around easily.

Blocks make page layout easy. They were first introduced in the post/page editor then added to the Widgets editor.

How to Switch to Classic Widgets?

New WordPress versions automatically add Block Widgets. If you’re still stuck in the “80s” or using some legacy code you can enable the classic widgets by installing the Classic Widget plugin.

How to add content to widget areas

Widget areas are created by the theme creators which are programmers. The theme you are using determines the widgets areas. Most themes have a sidebar, header and footer widget areas.

To add content to a widget area go to the Widgets page in WordPress. You’ll see the registered widget areas there. Click on a widget area and click the + button to add content. Content can be anything you want; text, images, HTML, paragraphs, shortcodes etc.
Once you’re done click Save.

How Widget Areas are Created

If you have limited widget areas and want to add more widget areas you can do so by writing some code.

You can register a Widget area by the adding the following code to your theme’s function.php:

One you have registered the widget or sidebar area nothing will happen until you indicate the widget area in the
template files (page, single, category, archive etc). You do so by adding the following code to any place in your template code: