Widget
In WordPress, widgets are elements that can be integrated into your site’s sidebars, footers, headers, and other regions outside of the main content area.
When you come across a WordPress blog with a sidebar showcasing links to the blogger’s social media accounts or suggestions for related posts, those elements are typically widgets.
Common examples of widgets include calendars, banner ads, search bars, and more. If you’re using a non-block WordPress theme that provides widget areas, you’ll find a Widgets section in the menu of your WordPress dashboard.
This section allows you to view the available widget areas of your theme and add widgets accordingly.
So, what is the function of a widget in WordPress?
Widgets serve to present various types of content in diverse sections of your website (such as the sidebar, footer, or header) without the need to modify the theme’s code directly.
These widget areas are helpful for displaying supplementary information on a page while keeping the main content focused and user-friendly.
WordPress comes with default widgets that you can use, such as archives, calendars, latest posts, navigation menu, social media icons, RSS feed, tag cloud, categories list, and so on.
Are Widget Areas and Widgets Different?
Widget areas are designated locations where you can place widgets, and widgets are the individual content components you incorporate into these areas.
Various WordPress themes offer different widget areas, which can be found in the header, footer, sidebar, directly beneath your blog post content, and in nearly any other section of your site.
For instance, here are some of the widget areas available in the Astra theme:
On a typical WordPress website, all pages share the same widget areas, meaning that the same widgets will be displayed throughout your site. However, there are options to display specific widgets on designated pages only.
This capability is particularly useful if you want the widgets on your homepage to differ from those on your blog posts.
For detailed instructions on how to show or hide widgets on specific pages, check out our article.
Additionally, our guide on setting up different sidebars for each post and page in WordPress may also be helpful.
What Is the Difference Between a Widget and a Block?
In WordPress, blocks are content elements added to your posts and pages, while widgets serve a similar purpose but are specifically placed in your theme’s widget areas.
With the release of WordPress 5.8, the distinction between widgets and blocks has become less pronounced, as both utilize a block-based editor.
This allows you to drag and drop blocks into widget areas just as you would in the Gutenberg editor for posts and pages. You can also find the default WordPress blocks available as widgets for your widget areas.
To learn more about the differences between widgets and blocks, refer to our article on WordPress widgets versus blocks.
What Is the Difference Between a Widget and a Plugin?
A WordPress plugin is an extension that you install to add custom features to your entire website. In contrast, a widget is a content element that you place within the widget areas of your pages, including sidebars, footers, and headers.
Some plugins come with their own widgets designed for your widget areas.
For example, if you use WPForms, you can create and manage contact forms to gather inquiries from your visitors. Below is a preview of what the plugin page looks like:
Once you have created a contact form, you can go to the Widgets page on your WordPress dashboard and add the form widget to one of your widget areas.
This feature is available whether you use the paid or free plugin.
Additional examples of plugins featuring widgets include Smash Balloon (for integrating social media feeds), WooCommerce (to showcase your eCommerce products), and Envira Gallery (for creating image galleries).
Can You Use WordPress Widgets with Any Theme?
WordPress widgets are exclusively compatible with classic WordPress themes.
A key indicator that you are using a classic theme is the presence of the Appearance » Customize option in your admin panel, which directs you to the WordPress customizer.
In the same menu, you’ll also find a Widgets option.
If you use a block WordPress theme, then there will be no Widgets item in your WordPress admin menu.
However, you can still add content to your footers, headers, sidebars, and other parts of your theme using the WordPress Full Site Editor.
How to Add Widgets to Your WordPress Site
If you use a classic theme and want to use WordPress widgets, you can go to the Appearance » Widgets page from the admin sidebar. Once you’re there, you’ll see your theme’s widget areas in the main content section.
To see all the available widgets, just click the ‘+ Add Widget’ button on the widget area or on the top-left corner.
As you can see, you will see various types of widgets, such as the text widget, search widget, recent posts widget, and many more.
To add a new widget to the widget area, just click on it or drag and drop it to your desired place.
Each widget comes with its own settings which you can see on the left side when selecting the widget.
For example, if you use the latest posts widget, when you click on it, the widget settings include options to show elements of the posts, order them from newest to oldest, and edit the number of posts to display.
Once you’re done adding and editing the widgets, click on the ‘Update’ button to make your changes live.
For more detailed instructions, see our complete guide on how to add and use widgets in WordPress.
Can You Create a Custom Widget in WordPress?
Certainly! Here’s a revised version of your text: Absolutely, you can build a custom widget in WordPress. However, it’s worth noting that this process may be challenging for beginners, as it requires modifications to the functions.php file and a basic understanding of PHP coding.
We strongly advise backing up your website and/or utilizing a staging environment when developing a custom widget to avoid any critical errors.
For further guidance, check out our comprehensive step-by-step tutorial on creating a custom WordPress widget, which includes a code template for a simple widget.
We hope this guide has enhanced your understanding of widgets. Additionally, you might find our Additional Reading list below useful, featuring articles on various WordPress tips, tricks, and ideas. If you found this article helpful, consider subscribing to our YouTube Channel for WordPress video tutorials, and feel free to connect with us on Twitter and Facebook.