I am building a site in Wordpress. It has multiple subpages, many of which require different sidebars. So, I have a widgetized theme and I have also created a few sidebar widgets.
I have written a conditional statement to show different sidebars on different pages. However, one widgetized sidebar displays on almost all pages despite the conditional statement.
The sidebar that is appearing on the desired page can be seen here: http://www.africanhealthleadership.org/about/approach/
The subpage that should have a different sidebar is under Knowledge Resources>Research
The code is as follows. I am a total PHP spazz, so I likely did something silly. I have tried single quotes around dynamic_sidebar(2) but that did not work.
Thank you for any help.
<?php
if ( is_subpage('approach') ) {
if (!function_exists ( dynamic_sidebar(1) ) ) ;
}
elseif ( is_subpage('research')) {
if (!function_exists( dynamic_sidebar(2)) || !dynamic_sidebar( "Sidebar2") );
}
?>