The default WordPress installation comes built in with several widgets, such as Recent Posts, Search, Text, Calendar, and so on. The theme you choose may also provide one or more theme-specific widgets. Most of these widgets are designed for blogging features or common features of a website. The custom widgets become very important in handling the advanced requirements of sites beyond just blogging and basic content management features.
We can use themes or plugins to create custom widgets from scratch. Displaying advertisements, post ratings, and videos are some of the custom widgets that provide functionality beyond a usual site. In this recipe, we are going to create a widget from scratch in order to display pages with a specific page template.