I am using a custom sidebar for homepage of Bitdoz, my sidebar on homepage has less widgets than the other pages. In this tutorial, I will use the easiest method to add custom sidebar on homepage in Genesis blog. There are few methods already on other sites that I saw, most of them include adding a custom sidebar PHP file using FTP, beginners might not be comfortable with those tutorials, so I will only make us of the functions.php file in this tutorial.
I have already written few tutorials for Genesis framework including Custom Social Share buttons for Genesis and Horizontal Subscribe Box for Genesis. This is another tutorial in the same series and I will be posting more soon.
How to Use Custom Sidebar on Homepage in Genesis Framework
- Registering the Custom Sidebar
- Removing the default sidebar and adding our custom sidebar conditionally
- Adding desired widgets to our custom sidebar
How to Register a Custom Sidebar in Genesis
To register a custom sidebar open the functions.php file of your Genesis child theme by going to Dashboard > Appearance > Editor and add the code below to the functions.php file. This will register a custom sidebar with name Custom Homepage Sidebar.
How to Add Custom Sidebar to Homepage Conditionally
Further add the following code to the same functions.php file of your Genesis child theme, we are using is_home() conditional tag to show this custom sidebar on homepage only. The remove_action code will remove the default Genesis sidebar from homepage only, as it is also inside the conditional tag. If you need more information about the codes being used, leave a comment with question.
Add the Desired Widgets to Custom Homepage Sidebar
If the above codes are added correctly, the sidebar will appear in Dashboard > Appearance > Widgets with name Custom Homepage Sidebar as in the screenshot, add your desired widgets to the sidebar and you are done. Test the sidebar by adding different widgets to your default sidebar and homepage sidebar.
If you still have any questions regarding this tutorial leave a comment below.