WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] condition based dynamic sidebar (2 posts)

  1. MrsAngelD
    Member
    Posted 11 months ago #

    Ok I'm kinda new to coding with php. But what I'm trying to do is have a particular dynamic sidebar active on a particular page only if that sidebar is active. If it's not active I wish it to load the sidebar that is used on the rest of the site. but I can't for the life of me figure out how to code it.

    I have the following, but it doesn't seem to be working.

    <?php if ( is_page(190) ) { ?>
    
                <?php if ( !function_exists('dynamic_sidebar') && is_sidebar_active('forum_sidebar') || !dynamic_sidebar('forum_sidebar') ) : ?>
    
    			<?php endif; ?>
    
        		<?php } else { ?>
    			<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : endif; ?>
                <?php } ?>
  2. MrsAngelD
    Member
    Posted 11 months ago #

    Nevermind I fixed my problem with the plugin Dynamic Widgets

Reply

You must log in to post.

About this Topic