• Resolved onethousandseas

    (@onethousandseas)


    I think I’m doing this wrong:

    I’m trying to put in a custom sidebar, so I made a file named “sidebar-optional.php”.

    In the file I put:

    <div id="optionalsidebarcss">
    <ul style="list-style: none;">
    <?php if ( function_exists ( dynamic_sidebar(sidebar-optional) ) ) : ?>
    <?php dynamic_sidebar (sidebar-optional); ?>
    <?php endif; ?>
    </ul>
    </div>

    In the functions.php file I put:

    <?php 
    
    if ( function_exists ('register_sidebar')) {
        register_sidebar ('sidebar-optional');
    } 
    
    ?>

    However, any widgets I put in this sidebar won’t show up.

    Any suggestions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Change.

    <?php if ( function_exists ( dynamic_sidebar(sidebar-optional) ) ) : ?>
    <?php dynamic_sidebar (sidebar-optional); ?>
    <?php endif; ?>

    to.

    <?php if ( function_exists ( 'dynamic_sidebar' ) && dynamic_sidebar('sidebar-optional') ) : endif; ?>

    Thread Starter onethousandseas

    (@onethousandseas)

    Darn, unfortunately that doesn’t work either. Any other ideas?

    When that’s the same code i use to display one of my sidebars…

    Perhaps there’s a problem with the registering sidebar code…

    Try using this format..

    register_sidebar(array(
    		'name' => 'PUTNAMEHERE',
    		'before_widget' => '',
    		'after_widget' => '',
    		'before_title' => '<h2>',
    		'after_title' => '</h2>',
    	));

    Thread Starter onethousandseas

    (@onethousandseas)

    Success! Thank you so much!

    (Weird because my regular sidebars worked fine on the code I showed you but hey as long as it works ??

    No worries.. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Widgetizing a custom sidebar’ is closed to new replies.