- This topic has 9 replies, 3 voices, and was last updated 3 years, 2 months ago by Elvin.
-
AuthorPosts
-
February 22, 2019 at 5:31 pm #818274EG
Hi there,
Is there any way to divide the top bar and header into segments with certain length (i.e 3 segments with 50%, 30%,20% of the container) and place different widgets in each of them.Thanks,
EGFebruary 22, 2019 at 6:01 pm #818284TomLead DeveloperLead DeveloperTo do this in the header, you’d likely need to replace the header element with your own header element.
To do this, you could:
1. Create a new Hook Element: https://docs.generatepress.com/article/hooks-element-overview/
2. Set the hook toheader
and check the “Disable Site Header” checkbox.
3. In your content area, add this:<div class="header-section"> <div class="header-section-1"> Content for first section </div> <div class="header-section-2"> Content for second section </div> <div class="header-section-3"> Content for third section </div> </div>
Now you just need a little CSS:
.header-section { display: flex; } .header-section > div { width: 33.33333%; } @media (max-width: 768px) { .header-section > div { width: 100%; } }
Depending on your browser requirements, you might want to run that code through this tool: https://autoprefixer.github.io/
To add widgets in those sections, you could use a plugin like this: https://wordpress.org/plugins/widget-shortcode/
Then be sure to check the “Execute Shortcodes” checkbox as well.
February 22, 2019 at 11:01 pm #818408EGThank you Tom. Is there any way to divide the header into segments with different lengths (like first segment is 50%, second 20% and third 30%), instead of having 33.333% for each?
I couldn’t find the “Disable Site Header” checkbox. I added a new elements as hook then chose wp_head option. Is this the right way?
Lastly how can I contain the length of the header within the container, but full length?
Thank you, EG
February 23, 2019 at 8:34 am #818891TomLead DeveloperLead Developer1. First, remove this:
.header-section > div { width: 33.33333%; }
Then add this:
.header-section-1 { width: 50%; } .header-section-2 { width: 20%; } .header-section-3 { width: 30%; }
2. You’ll want to select the
header
hook, instead ofwp_head
.3. Not too sure what you mean by the length. Can you explain a bit more?
Let me know 🙂
February 11, 2021 at 2:43 pm #1655093JamieI got this to work on my site but I was wondering if you could help me get the logo into the first section of the header or suggest an alternative to what I have now. the section pushed my logo down and I would like to top align them.
February 11, 2021 at 3:05 pm #1655103YingStaffCustomer SupportHi Jamie,
Any chance you can link us to the site in question?
You can use the private information field.
Thanks!
February 11, 2021 at 3:14 pm #1655109JamieFebruary 11, 2021 at 7:49 pm #1655239ElvinStaffCustomer SupportHi Jamie,
The private information text field can only be used by the topic starter.
That said, Can you open up a new topic for this? So you could use the private information text field to provide us the site details. Thank you.
February 12, 2021 at 7:10 am #1655927JamieHi Elvin,
Yes, I can start a new topic.
Thanks, Jamie
February 14, 2021 at 5:35 pm #1658356ElvinStaffCustomer SupportNo problem. 😀
-
AuthorPosts
- You must be logged in to reply to this topic.