Community Forums › Forums › Archived Forums › General Discussion › Newbie Child in Themes: Is it best practice to use widget area's for front page?
Tagged: front page, widgets
- This topic has 6 replies, 2 voices, and was last updated 7 years, 3 months ago by Brad Dalton.
-
AuthorPosts
-
January 2, 2017 at 1:19 pm #198617BlueFoxxMember
Hi there,
I'm building my first Child Theme and followed some courses to gain knowledge. Bringing this knowledge in practice, I immediately stranded at my first section.
I want to build a top header like this: http://kids.cmsmasters.net/ (the purple with the adress and social icons). As I see it I have more than one option:
- Create widget area's in functions.php and hook em to genesis_before_header or genesis_before
- Hardcode this somewhere as a custom header
- Build it with Beaver Builder plugin that I also use
Since this is a section that always needs to be active in this theme there's no point in making it flexible through widgets. But if I read some blogs / video's / tutorials I always read that you should hook everything and that it seems to be best practice to create widget area's. Is that true? What would be the best way to do this considering website performance, and just the most logical way to do this. With a page builder the plugin creates the code for me, but i want to know the DIY way / understand it. What if you do it with a separate file containing the necessary HTML and include this in your front-page setup function?
Could someone point me in the right direction?
Thanks alot!
Sander
January 2, 2017 at 1:24 pm #198620Brad DaltonParticipantIf you look at all the new HTML Pro themes, most include widget areas hard coded into the front-page.php template file.
January 2, 2017 at 1:53 pm #198626BlueFoxxMemberHi Brad,
Thanks for your quick response! But the widget area's in front-page.php only apply to the front-page right? So then I should create another widget area for the rest of the posts. But that does seem a bit inefficiƫnt. Or is this just wrong thinking?
January 2, 2017 at 1:58 pm #198629Brad DaltonParticipantGenesis already includes a entry footer widget for single posts which enables you to display unique content in single posts different to your front page.
January 2, 2017 at 2:06 pm #198630BlueFoxxMemberOk so then use 2 widget area's for one site-wide topheader? How is the entry footer used for a top header?
The goal here is not to display unique content to a certain page type. All the pagetypes should contain the same topheader as displayed in the example template in my first post.
I think a widget area that is used sitewide must do the trick. But still, why use widgets? Widgets are flexible, but I don't need flexibility for this topheader as it's supposed to show up on every page and will not be changed.
January 3, 2017 at 2:28 am #198668Brad DaltonParticipantJanuary 3, 2017 at 2:34 am #198670Brad DaltonParticipantIf you want to add a image, use the code in this Gist
You can change the hook and add a conditional tag if needed.
Another option is to grab the code from a SP HTML Pro theme which includes the jQuery for Backstretch.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.