Title: Sub pages: custom sidebar
Last modified: August 21, 2016

---

# Sub pages: custom sidebar

 *  Resolved [sha12sha](https://wordpress.org/support/users/sha12sha/)
 * (@sha12sha)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/sub-pages-custom-sidebar/)
 * Hi,
 * I have a theme with a sidebar for every kind of page, tag and categories. Now
   I have sub pages and I have put this code in the sidebar.php
 * <?php if(is_page(‘2190’)){ ?>
 * But nothing is shown in the subpage. I have search and I have found another solutions,
   like
 * <?php if($post->post_parent =’2190′){ ?>
 * Then I can see the custom sidebar in the subpage and I have two sidebars in the
   rest of the blog: the original for every tag, category and pages, and at the 
   end of this one, the custom sidebar of the subpage… Any idea? Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/sub-pages-custom-sidebar/#post-3826230)
 * try to put the two into one and correct the comparison operator:
 * `<?php if( is_page(2190) || $post->post_parent == 2190 ){ ?>`
 *  Thread Starter [sha12sha](https://wordpress.org/support/users/sha12sha/)
 * (@sha12sha)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/sub-pages-custom-sidebar/#post-3826261)
 * Thanks for the help alchymyth!
 * The sidebar still is empty 🙁
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/sub-pages-custom-sidebar/#post-3826269)
 * does the sidebar show for the page directly?
 * possibly try to add `global $post;` before the `if`
 * please post the full code of sidebar.php
 *  Thread Starter [sha12sha](https://wordpress.org/support/users/sha12sha/)
 * (@sha12sha)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/sub-pages-custom-sidebar/#post-3826271)
 * Hi,
 * I made a new sidebar only for this page, as people recommended in this topic:
 * [http://wordpress.org/support/topic/sidebar-per-page?replies=23](http://wordpress.org/support/topic/sidebar-per-page?replies=23)
 * And it works!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Sub pages: custom sidebar’ is closed to new replies.

 * 4 replies
 * 2 participants
 * Last reply from: [sha12sha](https://wordpress.org/support/users/sha12sha/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/sub-pages-custom-sidebar/#post-3826271)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
