Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm working on project, where I have different widgets on pages and also different order. Example - on About page I may have chat widget, then e-mail sign-up widget, then testimonials widget. On other page I may have testimonials widget only, followed by chat widget. I'm using this code to show widgets on pages and children pages

<?php if ( is_front_page() ){  ?>       

<?php }elseif ( is_page('areas-we-service') || $post->post_parent == '16' ){ ?>
Do stuff here   
<?php }elseif ( is_page('products') || $post->post_parent == '14' ){ ?>
Do stuff here
 <?php }else{ ?> <?php } ?>

and it work. The problem is that it not work on subchildrent pages e.g. Product -> Product 1 -> Product 1.1 On Product 1.1 I don't have widgets. So, my question is, how to change code above to show widgets on subchildren, sub-subchildren etc. pages.

Thank you!

share|improve this question
add comment

2 Answers 2

I use Widget Logic at my blog. It is not most convenient solution around, but definitely one of the most flexible. Widgets can be displayed/hidden based on arbitrary PHP condition. Works great with conditional tags and when that is not enough you just write your own conditions and use them.

share|improve this answer
add comment

look at Custom sidebars plugin that lets you define sidebars per page/post basis.

or you can use is_page() with the page id like this:

is_page('322')

that way you define per page.

hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.