In this tutorial, i’ll show you how to add 2 more widgets to the backcountry child theme by StudioPress.
This is a question i answered recently on the forums:
I’d like to add 2 widgets above the home-top area of the Backcountry theme. Similar to the existing home-left and home-right, but I’d like them to execute them before the home-top section such that they take up the full width before the primary sidebar comes into play.
I know how to register the new widgets, but I’m not sure how to add them correctly in the home.php file as I don’t see a reference to the home-top section to execute them before.
Thanks for any help you might be able to give.
Out of the box, this theme already includes 6 home page widgets however this code will add another 2 before your top-left and top-right widgets.
Here’s a screenshot of the new widgets added in the home.php file:
There’s 2 code blocks which need to be pasted into 2 different files:
home.php – Simply copy this PHP code from the view raw link and paste it at the beginning of your child themes home.php file after the opening php tag.
functions.php – Paste this code at the end of your child themes functions.php file.
Style Widgets – CSS Code?
There’s no CSS code needed for styling these widgets as i have used exactly the same classes as the existing home page widgets are using.
If you want to style widgets differently, you can easily change the classes to something different and use the new classes in your child themes style.css file.
Leave a Reply
You must be logged in to post a comment.