Title: Sidebar if condition
Last modified: August 18, 2016

---

# Sidebar if condition

 *  [Akram Taghavi-Burris](https://wordpress.org/support/users/taghaviburris/)
 * (@taghaviburris)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/sidebar-if-condition/)
 * Is there a way to place an if condition in the sidebar.php to display certain
   elements depending on what page, or category is being displayed?
 * For example I want the Recent posts to show up on sub pages, but not on the index.
   php.
 * Also I want the subcategories to be seen only on the category-4 page but not 
   on other.
 * Please let me know if this is possible.
 * Also, I’m a newbie, when it comes to php, so please keep that in mind and try
   and simplify the explanation.
 * Thanks.

Viewing 1 replies (of 1 total)

 *  [Root](https://wordpress.org/support/users/root/)
 * (@root)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/sidebar-if-condition/#post-596134)
 * The answer is yes. But where I am confused is whether that could be integrated
   with the widget set up.

Viewing 1 replies (of 1 total)

The topic ‘Sidebar if condition’ is closed to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [Root](https://wordpress.org/support/users/root/)
 * Last activity: [18 years, 10 months ago](https://wordpress.org/support/topic/sidebar-if-condition/#post-596134)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
