Recently i showed you how to duplicate home page widgets for use in other areas of your site.
Well there’s any easier way to do this as long as you want to keep the widgets styling exactly the same as what you have on your home page.
You can still display any of your home page widgets in other positions on a page, post or archive and also use conditional tags to determine which pages you display the same widget, if needed.
The big bonus is, you DON’T need to:
- Register a new widget
- And you don’t need to copy or add any CSS code
All you need to do is use the same div i.d and the same div class which is used on your home page widget.
This makes for more efficient coding and less errors.
Here’s the code i used to duplicate one of the home featured widgets site wide before the footer.
You can see its a very simple custom function containing:
- A conditional tag to exclude the home page which already contains this featured widget
- A Genesis hook to display the existing widgets content before the footer
There’s absolutely NO CSS or PHP code for registering a new widget, so its highly efficient.
Isn’t this awesome? Try doing that with a theme that doesn’t include hooks.
Why would you want to hack your parent themes template files and add more code which only uses more resources and takes longer to load?
Custom functions enable you to move from theme to theme.
If you edit your template files, you’re going to pull your hair out trying to find the code you’ve edited or added to your template files. And what happens when you update the parent theme? You lose everything!!
No wonder 95% of bloggers give up in the first year. One of the reasons is they find customization too hard because they’re using the wrong theme.Subscribe for new Genesis Tutorials