Recently, I received the question if it was possible to add a sidebar to the Whitespace Pro theme. In this tutorial, we are exploring the options for the full-width, sidebar-content and content-sidebar layout. It only takes four easy steps.
1. Enable the layout options
Open the functions.php file with a text editor. If you don’t have a good text editor, you might want to consider Sublime Text. Look for the following lines in your functions.php and remove them. You’ll find them around line 63.
These lines of code unregister the layout options for content-sidebar and sidebar-content. By removing these lines of code, the layout options will become visible again in the back-end.
2. Enable the sidebar
Next, look for the following piece of code in your functions.php and remove it. You’ll spot it somewhere around line 70.
This line of code unregisters the default sidebar. By removing this code, the sidebar will become visible as widget area at Appearance > Widgets.
3. Remove forced full width layout
The Whitespace Pro theme has a forced full width layout. Without removing this functions, all of the proposed changes won’t have effect. So, let’s have another look in the functions.php file. Locate the following piece of code and remove it. You’ll probably need to check around line 82.
4. The styling
Open the style.css file with your text editor. Add the following lines of css to the style.css file. Place these line at the end of the stylesheet.
Well done! You should be able to select a sidebar-content or content-sidebar layout. The result will look like this.