Title: Conditional Output from Widget
Last modified: August 19, 2016

---

# Conditional Output from Widget

 *  [Joshua Lyman](https://wordpress.org/support/users/uplink/)
 * (@uplink)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/conditional-output-from-widget/)
 * I am currently widgetizing a theme that I made from a while ago, and have a question
   regarding how to work with the widget codes used in sidebars.
 * I have a widget sidebar defined, but it does not always show up, or it is a widget
   sidebar that is optional. However, when it _does_ show up, it needs to be wrapped
   in a container layer, for display purposes. I can’t do this through the before_
   or after_widget variables.
 * Is there a way I can test to see if the sidebar has been defined and called and
   output something before it spits out the rest of the code for the widget? Thanks!

The topic ‘Conditional Output from Widget’ is closed to new replies.

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * 0 replies
 * 1 participant
 * Last reply from: [Joshua Lyman](https://wordpress.org/support/users/uplink/)
 * Last activity: [17 years, 11 months ago](https://wordpress.org/support/topic/conditional-output-from-widget/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
