How to Display Widgets in WordPress

Sidebar or Widget area can be used to show widgets in the part of website where it is located. Widget area can be anywhere either in left side of content or right side of content, in header area or footer area.

Available widgets can be found in Appearance -> Widgets in WordPress Admin Area and can be dragged to display in available widget areas.

Other Method of showing widgets are by the_widget template tag. By using this template tag widgets can be displayed in any part of websites without a sidebar/widget area.

example:

Where:

WP_Widget_Recent_Comments,
WP_Widget_Text,
WP_Widget_Calendar,
WP_Widget_Archives are the widget’s PHP class name.

A more interesting option is to display widgets inside page or post. It can be achieve by using a plugin named amr shortcode any widget . By using this plugin, widgets can be displayed using a shortcode.

It uses [do_widget widgetname ] or [do_widget "widget name" ] shorcode to show widgets. More details can be found on plugin page.

Related posts

Leave a Comment