In the production of WordPress template , perhaps you will encounter a sidebar sidebar does not fully meet your needs, or too much sidebar content causes the page too long, then we can consider using two or more sidebar.
Considering the need to modify the functions.php and sidebar.php files, back up the files before you start just in case.
First look at the functions.php file. The beginning of a piece of code in the file is this:
if function_exists (' Register_sidebar '))
Delete the code and the corresponding closing parenthesis, and then add the following:
if function_exists (' Register_sidebar ')) Register_sidebar (array(' name ' = ' sidebar1 ', ' before_widget ' = ' ", ' After_widget ' + ', ' before_title ' = ' ; >
This is a sidebar of the corresponding code, if we want to be two sidebar effect, then add a section of the sidebar code, into:
if function_exists (' Register_sidebar ')) Register_sidebar (array(' name ' = ' sidebar1 ', ' before_widget ' = ' ", ' After_widget ' + ', ' before_title ' = ' ; Register_sidebar ( Array(' name ' = ' sidebar2 ', ' before_widget ' = ' ', ' after_widget ' + ', ' before_title ' = ;? >
If you want to display more than a few sidebar, just copy the same code snippet, and then change the number behind the SIDEBAR1/2.
After registering the necessary sidebar, there are three widget boxes in Wp-admin's Wiget, and then we need to activate the sidebar so it can be displayed at the front of the blog.
After you open the sidebar.php file, you will see a line of code like this:
if ( ! function_exists endif;?>
Delete it, then add:
if ( ! function_exists endif;?>
The above code makes SIDEBAR1 appear in the front of the blog. To display both SIDEBAR1 and SIDEBAR2, join:
if ( ! function_exists endif if ( ! function_exists endif;?>
And so on, to display sidebar345, add the same code and change the numbers slightly.
Done.
Note: When modifying the functions.php file, be careful to remove extra closing brackets or spaces.
How to make WordPress blog add multiple sidebar sidebar