- This topic has 10 replies, 2 voices, and was last updated 4 years, 9 months ago by Leo.
-
AuthorPosts
-
July 21, 2019 at 5:45 am #963251Mike
Hello,
So, I’m setting up a site using GeneratePress, and I’m trying to figure out if there’s a way to achieve a specific setup.I’ve looked over the options and maybe I’m just blind, but I can’t see any built-in way to do this.
I want to use GeneratePress’s Header elements to have specific headers for different blog pages (based on Category).
However, I want the header to only sit above the top-most blog listing, restricted to that space. I don’t want it to stretch the entire page, pushing the right-bar widgets down.
I setup a quick and ugly mockup to show what I’m trying to accomplish. Is there any way to do this directly with GeneratePress, or do I have to go with a plugin? The teal-ish box shows what I’m trying to do.
Thanks for any help!
July 21, 2019 at 9:19 am #963506LeoStaffCustomer SupportHi there,
Are you wanting to do this for all the header elements or just for the blog/archive pages?
Let me know π
July 21, 2019 at 10:32 am #963539MikeJust the blogs. Don’t see the need for them on any other page, though who knows.
I suppose on any page where a side bar is displayed would be good, too, though. Just to keep future possibilities open. But just for blog pages at the moment.
Thanks!
July 21, 2019 at 8:16 pm #963745LeoStaffCustomer SupportWe can use this filter:
https://docs.generatepress.com/article/generate_page_hero_location/With
generate_before_main_content
hook:
https://docs.generatepress.com/article/hooks-visual-guide/Adding PHP: https://docs.generatepress.com/article/adding-php/
Let me know π
July 22, 2019 at 4:31 am #963984MikeThanks for that.
Unfortunately, going anywhere near PHP code terrifies me on a plain, straight-forward site. Messing with WP files, with how broken up and modular everything is, is a complete no-go. I’m strictly a designer, and programming/dev is way outside my wheelhouse.
I’ll have to find another way around doing it, or just deal with it the way it is.
Thanks for your time and help anyway. I’m sure that info will help others out as well.
Thanks!
July 22, 2019 at 9:05 am #964279LeoStaffCustomer SupportThis one should be super simple though.
Try this for your full code:
add_filter( 'generate_page_hero_location', function() { return 'generate_before_main_content'; } );
The easiest method is to use Code Snippet:
https://docs.generatepress.com/article/adding-php/#code-snippetsSimply copy and paste the code above and click save and activate and you should be good to go.
Let me know π
July 23, 2019 at 8:46 pm #965590MikeSo, I just install that plugin, copy and paste the code in, and WP “just knows” what to do with it?
Hmm… Sounds like some spooky voodoo to me, but I suppose I could try it.
Thanks π
July 24, 2019 at 3:07 am #965758MikeSo I got it set up and it seems to work!
Had unintended consequences, though. It got me digging through the header elements bit and now I’m really curious about how I might spice up the site a bit more. It’s very “vanilla standard blog” looking in its current state, and I think I’d like to give it some more personality.
So… time to learn and experiment a bit more. Also, I think I might have gone overboard with plugins.. I dunno.. I’ve heard it’s best to keep them to like 7 or 8 and I’m going on almost twice that.
Anyways.. thanks again for that code and help! Much appreciated!
July 24, 2019 at 8:43 am #966109LeoStaffCustomer SupportYou can have a look at our site library page for inspirations:
https://generatepress.com/site-library/I’ve heard itβs best to keep them to like 7 or 8 and Iβm going on almost twice that.
As long as the plugins are well coded, it shouldn’t matter too much how many you are using.
Glad I could help π
July 24, 2019 at 7:52 pm #966509MikeThanks again!
I do have a question about the Header Elements…
Is that intended to override, or be used in lieu of the header options in the Layout section? I notice there’s overlap there, and I’m not sure if they fight with each other, complement each other, etc.
Thank ya
July 25, 2019 at 8:36 am #967073LeoStaffCustomer SupportThey are two separate things.
If you take a look at this example:
https://docs.generatepress.com/article/page-hero-examples/#example-1The white part is the site header, the blue part is the header element.
-
AuthorPosts
- You must be logged in to reply to this topic.