0

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!

2 Answers 2

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.