Archived topic
Hero element ABOVE main navigation menu
16 replies · Started by Vera on March 31, 2020
Hello,
I have tried for several hours but have not been able to figure out how to do this:
I have a horizontal main navigation menu and a horizontal secondary navigation menu on all my pages. The secondary menu is at the very top of each page.
On my home (front) page only, I want to set up a hero element with a 300-400px high image below the secondary menu and then my main menu below the hero element. I want the same layout on all my other pages except I want to substitute a different 75-100px high art banner for the hero element.
I can set up the elements but can’t get them to appear between the two menus. Is there a way to do this while having a different treatment on the home page than the other pages?
I would appreciate any help. Thank you!
Hi there,
Try this PHP snippet:
https://generatepress.com/forums/topic/page-header-image-above-menu/#post-474517
Adding PHP: https://docs.generatepress.com/article/adding-php/
Let me know if this helps :)
Thank you for the quick reply. I tried creating and activating a “code snippet” using the plugin but it had no effect.
Can you tell me where to place the code or snippet? Would it be inside the html box on the hero element (setting) page? I’m reluctant to just experiment and possibly break my site. (I am not a coder.)
Also, I would like the same effect for all my other pages but with different images. I noticed the php code mentions “front page” which suggests it will only work for that.
Thanks again!
Code snippets should be the way to go if you aren't using a child theme already.
If you want that apply to every page then this should be the code:
https://generatepress.com/forums/topic/page-header-image-above-menu/#post-288568
Let me know :)
I get this error when trying to activate the snippet:
The snippet has been deactivated due to an error on line 3:
Cannot redeclare function craig_move_navigation.
Also, neither php snippet changes the position of the menu to below the hero.
Can you only add this one for now?
https://generatepress.com/forums/topic/page-header-image-above-menu/#post-288568
Make sure the navigation location is set to below header:
https://docs.generatepress.com/article/navigation-location/
It works now — thank you! I did have the menu set to appear below the header. I just had to deactivate the front page snippet and activate the other one. But I still need a different hero on my home page, and with the main menu below it.
I may also eventually want different banner art on different pages of my site. If I set up separate elements with display rules for each banner, will this code snippet still work?
Creating separate header elements and setting display options for specific pages does not allow me to use different headers for different sections (groups of pages).
Hi there,
couple of things:
1. For your Home Page select the Front Page Location in your Display Rules.
2. Beware of conflicts. For Example: If you first create a Header Element that is set to Pages > All Pages this will override a second Header set to Pages > Specific page. For this to work you would Exclude the Specific Page from your first header element
Thank you for your reply.
I attached images showing the settings for the only headers I currently have set up and the code snippet Leo directed me to for making my main navigation menu display below the banner art — in case that’s having any effect.
My header elements appear to be set up correctly, but the only one that displays the banner art is #2.
The links below are the pages I defined for banner art in their header elements and they are currently the only elements in my site. The numbers reference the red numbers on the image.
1: http://www.marshallart.com/HOME/
2: http://www.marshallart.com/HOME/seminars/human-anatomy/
3: http://www.marshallart.com/HOME/seminars/animal-anatomy/


Can you take a screenshot of the page hero settings for #1 the home page one?
Here you go. Anything that isn’t showing in these screenshots is either empty or a default setting. (The IMG button wasn’t working so I had to paste URLs this time.)
http://www.marshallart.com/HOME/wp-content/uploads/2020/04/AC00016B-EEDC-456D-81A5-37BB807E65EE.jpeg
http://www.marshallart.com/HOME/wp-content/uploads/2020/04/60A1EAA5-3E29-4B9B-B7BA-C73CB2D72FE9.jpeg
Is there anything added in the content box?
https://docs.generatepress.com/article/how-to-create-a-page-hero/#step-1-add-the-content
If you mean the box right above where my screenshot starts, no, there is nothing in that box. I will probably only have an image for now, but one day I would like to put a slideshow there. BTW: Can GeneratePress accommodate that?
Yup you just need to add some HTML comment in there as specified in the second paragraph here:
https://docs.generatepress.com/article/how-to-create-a-page-hero/#step-1-add-the-content
Let me know if this solves it :)