Two problems. To register the sidebar you need to pass a minimum of the 'id'.
if ( function_exists ('register_sidebar')) {
register_sidebar(array('id'=>'custom'));
}
Despite the Codex, I cannot get the sidebar to show up using only register_sidebar('custom');
That will make the sidebar show up on the backend. See the Codex for other parameters.
Secondly, there is nothing to load sidebar-custom.php
. dynamic_sidebar('custom')
would load a file named sidebar-custom.php
, at least the Codex appears to suggest that, but since you have that function call inside sidebar-custom.php
it never gets to run.
Third, you have curly quotes in you code. Look at the quotes around the class name.
So, to make this work put the following in functions.php
(same as above):
if ( function_exists ('register_sidebar')) {
register_sidebar(array('id'=>'custom'));
}
Place the following in the template file where you want to the sidebar to load but not in sidebar-custom.php
.
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('custom') ) :
endif;
Your sidebar should now work, but again despite the Codex or possibly the Codex is just very confusing on the point, I can't get your sidebar-custom.php
file to load.
To do that I have to explicitly use get_sidebar ('custom');
The more I worked on this, the more I came to believe that the Codex is poorly written when it come to custom sidebar files. The truth is in there but it is hard to see. Hope this helps.