For some reason, you may want to add more than one custom widget area in the same genesis_hook position. To do this you can use the same div class in the function so the styling is exactly the same for each or you can use a unique class for each.
In this code, you’ll see 2 different classes meaning you can style each widget differently.
Copy this code from the view raw link and paste it at the end of your child themes functions.php file using your favorite code editor like Notepad++.
The reason this code works and outputs the content for each widget one after the other is because of the 3rd parameter which has been added to the code.
The 1st widget uses a priority of 5 and the 2nd uses a priority of 6.
This results in the first widget displaying first in the hook position you include in the code (genesis_after_post).
The second widget displays below the first because it has a priority of 6 giving the first widget priority positioning when using the same hook.
You could add more widgets to the same hook as long as you add a priority to each action which is below 10. If you used a priority above 10, your widget would display below the comments form.
A Better Way To Create Multiple Widgets?
Know of a more efficient way to add multiple widgets to the same hook location in Genesis?
Leave a Reply
You must be logged in to post a comment.