0
votes

Here is the code in functions.php:

register_sidebar(array(
    'name'=> 'Home Page Advanced Search',
    'id' => 'custom'
));

register_sidebar(array(
    'name'=> 'Profile Picture Upload',
    'id' => 'pic upload'
));

Then, I use the two sidebars in my template like this:

?php if ( is_active_sidebar( 'custom' )) : ?>
            <div id="widget-area">              
                <?php dynamic_sidebar( 'custom' ); ?>
            </div>
<?php endif; ?>


<?php if ( is_active_sidebar( 'pic upload' )) : ?>
            <div id="upload-photo-area">
                <?php dynamic_sidebar( 'pic upload' ); ?>
            </div>
<?php endif; ?> 

The sidebar with id='custom' works fine. I am able to put widgets in it in my dashboard and display them. The sidebar with id='pic upload' is not working correctly. All widgets that I put inside of it do not stay there (in the dashboard API) and, therefore, do not display on my page.

All help is appreciated. Thanks in advance.

1
You can't have a space in the name of a sidebar.Howli

1 Answers

2
votes

You can't have a space in the name of a sidebar. As per the codex

If you name your own ID values in the register_sidebar() WordPress function, you might increase readability of the code. The ID should be all lowercase alphanumeric characters and not contain white space. You can also use the - and _ characters. IDs must be unique and cannot match a sidebar name. Using your own IDs can also make the sidebar name translatable.

I added the emphases. Change pic upload to pic-upload or pic_upload should fix that.