Managing Widgets

Posted on Feb 5, 2013 in Content, Plugins

What Are Widgets?

Widgets add content and features to the sidebar of your website.  Site administrators have access to the widget management area.

Adding and Removing Widgets

Navigate to Appearances > Widgets.

Screenshot showing where to access the Widgets management page.

Screenshot showing where to access the Widgets management page.

The Available Widgets area provides you with the types of widgets that are available to be added to your website.

To the right, you will see a Sidebar area.

Screenshot showing the Available Widgets and Sidebar areas.

Screenshot showing the Available Widgets and Sidebar areas.

Simply drag and drop a widget from the Available Widgets area into the Sidebar area.

In the example image below, I am adding a simple Text widget.

Screenshot showing the drag and drop of a widget into the Sidebar area.

Screenshot showing the drag and drop of a widget into the Sidebar area.

Fill out the available fields and Save.

Screenshot showing the fields of a Text widget.

Screenshot showing the fields of a Text widget.

To remove a widget, simply drag it out of the Sidebar area.

WARNING: Be cautious when working with widgets. When you remove a widget from the Sidebar area, it will be deleted for good!

To remove a widget and save it for later use, drag it out of the Sidebar area and drop it into the Inactive Widgets area, located further down on the page.

Screenshot showing the Inactive Widgets area.

Screenshot showing the Inactive Widgets area.

By doing so, you remove the widget from the being displayed on the website, but save the data and content that was created in the widget.

Specifying Widget Visibility

By default, widgets appear on every page that utilizes the sidebar.  There are ways to limit the display of a widget to a certain page/post or group of pages/posts.  Limiting widget visibility is handled by Widget Logic.  Widget Logic is a plug-in that adds extended functionality to WordPress widgets.

Every widget contains a Widget Logic field.  Use of the field requires knowledge of WordPress conditional tags.

Screenshot showing the Widget Logic field within a widget.

Screenshot showing the Widget Logic field within a widget.

A full list of conditional tags can be found here:  http://codex.wordpress.org/Conditional_Tags

Below I have listed some of the common conditional tags that we utilize.

is_page( 7 )

This says to only show the widget on the page with ID of 7.

 

is_page( array( 7,8,9 ) )

This is the code used to list multiple pages by ID.

Note: You can find the ID of a page by viewing the table listing of Pages (Pages > All Pages).

 

is_tree( 2 )

This is a useful statement that displays the widget on the specified page and all of its assigned children.

 

is_category(array( 7 ))

This will show the widget on the WordPress generated category listing page.

 

(is_single() && in_category( 7 ))

This will show the widget on each post that belongs to that specific category.

 

is_category(array( 7 )) || (is_single() && in_category( 7 ))

You can use a combination of multiple statements by using the double pipe symbol ||.

 

!is_page( 7 )

You can declare the opposite of any statement by including an exclamation mark ! at the front.  This will show on all pages except for the page with id of 7.