Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMauricio Alvarez Rojano
2,998 PointsWhy do you place the widgets in front-page.php?
I've been placing/hooking my widget areas in function.php file using some genesis hook like "genesis_after_header" for example. Just wondering why did you do it this way? And if it makes any difference? Is it a matter of best practices to hook the widgets in the front-page.php instead of the function.php if the widgets are going to be display only in the home page?
2 Answers
Zac Gordon
Treehouse Guest TeacherIn order to add the widgets in the way you mentioned we would have to add a hook to the front-page. Since this was a more beginners course we did not take that approach and instead added the code for the widgets directly into the template.
You can do either way. Using hooks is easier if your theme already has them and is something we cover more in a later Actions and Filters course :)
Mauricio Alvarez Rojano
2,998 PointsThank you Zac Gordon! Actually I was referring to the Genesis Theme Development course, but when I had to select the section of the question there was not the Genesis Theme Development so I had to post it to the WordPress section.
But i guess is a good practice to put it on the front-page.php file any ways! Thank you!