[Resolved] Restrict Page Header (Element) to above Blog list…

Home Forums Support Restrict Page Header (Element) to above Blog list…

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #963251
    Mike

    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!

    PageHeader Mockup

    #963506
    Leo
    Staff
    Customer Support

    Hi there,

    Are you wanting to do this for all the header elements or just for the blog/archive pages?

    Let me know πŸ™‚

    #963539
    Mike

    Just 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!

    #963745
    Leo
    Staff
    Customer Support
    #963984
    Mike

    Thanks 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!

    #964279
    Leo
    Staff
    Customer Support

    This 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-snippets

    Simply copy and paste the code above and click save and activate and you should be good to go.

    Let me know πŸ™‚

    #965590
    Mike

    So, 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 πŸ™‚

    #965758
    Mike

    So 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!

    #966109
    Leo
    Staff
    Customer Support

    You 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 πŸ™‚

    #966509
    Mike

    Thanks 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

    #967073
    Leo
    Staff
    Customer Support

    They are two separate things.

    If you take a look at this example:
    https://docs.generatepress.com/article/page-hero-examples/#example-1

    The white part is the site header, the blue part is the header element.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.