- This topic has 7 replies, 2 voices, and was last updated 6 years, 1 month ago by
Leo.
-
AuthorPosts
-
September 29, 2017 at 12:44 am #394035
Louis
Hi everyone,
I’m trying to do something fairly simple. At least I think I am, but I’m running into some issues.
My goal is to have my main navigation bar below my header on just one page. This works fine -in theory- if I use the site header for it.
However, I want to have my navigation bars at the top on all other pages and posts, so that the user can focus on the content rather than the massive site header that I created just for the front page.
My problem is that I can’t seem to find a way to switch the position of the navigation bar without using the site header in the customiser, which in turn ruins my front page layout if I remove the site title and padding.
Here’s a link to images that show what I’m talking about: https://imgur.com/a/X40st
I’m showing my desired front page and how it affects the other pages.
On a sidenote: I tried to add this code in simple CSS : `add_shortcode(
‘page_title’,’tu_page_title_shortcode’ );
function tu_page_title_shortcode()
{
return get_the_title();
}`and then use the page title shortcode in my page headers, but unfortunately it didn’t work.
All help appreciated!
September 29, 2017 at 7:55 am #394230Leo
StaffCustomer SupportHi there,
This should help: https://docs.generatepress.com/article/navigation-location/#generate_navigation_location
Let me know.
September 30, 2017 at 3:57 am #394661Louis
I’ve now removed site title, tagline and all vertical padding, meaning the site header has become non existant. I’m using the Page headers to create my headers for every page.
Also, the dynamic page titles work now that I’ve put the code into Code Snippets instead of Simple CSS! Makes sense heh.
However, my main navigation bar has vanished from all my pages because I’m using this code with code snippets:
add_filter( 'generate_navigation_location','tu_move_navigation' ); function tu_move_navigation( $location ) { if ( is_home() ) { return 'nav-below-header'; } }
My settings in the customizer have the nav bar located Above Header.
Am I missing something?
Second question: Is there a way for me to insert the site title and tagline when using Page Headers without using the site header merge toggle?
The problem here is that if I enable Site Title and Tagline in the Customizer, they automatically appear as part of a site header, which again will create a sitewide header above my page header OR, if I merge them, the title and tagline will appear on ALL pages.
Maybe there’s a way to add them to the page header specifically using the HTML container?
Thanks in advance!
September 30, 2017 at 9:28 am #394842Leo
StaffCustomer Support– Try this instead:
add_filter( 'generate_navigation_location','tu_move_navigation' ); function tu_move_navigation( $location ) { if ( is_home() ) { return 'nav-below-header'; } return $location; }
Also just to make sure that
is_home()
is targeting the main blog page.– Not sure what you mean? Where do you want to insert it? Can you link me to the page?
October 1, 2017 at 1:07 am #395142Louis
Nevermind the text. It’s not that important, I’ll make it work.
The new code made my navigation bar show up, but didn’t put it below my header. I switched is_home() for is_front_page() and it did the trick.
However, the problem now is that my navigation bar is still only below the site header, not the page header. Is there a way for me to fix this?
I tried looking at sections to see if I could just make a section to serve as my navigation bar, but couldn’t find an easy way to do it.
October 1, 2017 at 9:02 am #395373Leo
StaffCustomer SupportTry this function here: https://generatepress.com/forums/topic/flip-menu-and-page-header/#post-143766
October 4, 2017 at 8:47 am #397361Louis
That did the trick!
Thanks a ton!
October 4, 2017 at 10:11 am #397405Leo
StaffCustomer SupportNo problem!
-
AuthorPosts
- You must be logged in to reply to this topic.