• Resolved mktrails

    (@mktrails)


    I’m trying to place different place a different widgetized sidebar on the Contact page. I’ve registered the sidebar in the functions.php file and named it “Sidebar Contact”. That works fine.

    My problem is with the conditional logic I’m using in the sidebar.php file. Instead of only displaying the sidebar-contact, both “Sidebar Contact” AND the default sidebar are being displayed. There must be a logic flaw in the if / else statement.

    Can someone help??? I’m new to php.

    Here’s the code I’m using…

    <?php if(is_page(‘contact’)) { ?>
    <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(“Sidebar Contact”) ) ?>
    <?php } else { ?>
    <?php } if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar() ) : ?>
    the rest of the stuff….

Viewing 2 replies - 1 through 2 (of 2 total)
  • Here’s what I would try:

    <?php if (is_page('contact')) { ?>
    
    	<?php if( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Sidebar Contact") ) : ?>
    
    	<?php endif; ?>
    
    <?php }else { ?>
    
    	<?php if( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    
    	<?php endif; ?>
    
    <?php }?>
    Thread Starter mktrails

    (@mktrails)

    Worked perfectly! Thanks so much!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help with Conditional Widgetized Sidebar’ is closed to new replies.