- This topic has 7 replies, 2 voices, and was last updated 3 years, 8 months ago by David.
-
AuthorPosts
-
July 30, 2020 at 5:15 pm #1382427Daniel
I’m struggling to determine why my main menu is above my banner on Single Posts and the Blog page. I’ve set the Primary menu’s position to “Below Header” in the customizer (Layout > Primary Navigation). Is there a separate control for the Blog and/or single posts menu placement?
I have two Elements with Header parameters. One displays on Front Page only, the other appears on all Pages (except Front), Posts and Blog.
Thanks
July 31, 2020 at 1:38 am #1382692DavidStaffCustomer SupportHi there,
which code did you use to move the Navigation below the Header Element on the front page ?
July 31, 2020 at 7:51 am #1383135DanielHi,
I didn’t use any special code to move the Navigation below the Header Element on the front page…as far as I can remember (it’s been awhile). Just the Layout controls in the Customizer. No special css adjustments or php in header.php.
If you would like admin access, let me know how to send you credentials. Thanks.
July 31, 2020 at 12:58 pm #1383394DavidStaffCustomer SupportThis it the PHP Snippet that moves a after_header Primary Nav to below the Header Element:
add_action( 'after_setup_theme','craig_move_navigation' ); function craig_move_navigation() { remove_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 ); add_action( 'generate_after_header', 'generate_add_navigation_after_header', 15 ); }
Check to see if you have any similar function in your child theme before adding it your site.
July 31, 2020 at 1:16 pm #1383410DanielAh. I have this snippet:
add_action( 'wp', function() { if ( is_page() ) { remove_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 ); add_action( 'generate_after_header', 'generate_add_navigation_after_header', 15 ); } } );
It looks like this limited the change to pages. I’ll use your code instead, which works fine, thank you. Out of curiosity, how would I include posts and the blog page in the code I’m showing above?
July 31, 2020 at 1:21 pm #1383415DavidStaffCustomer SupportThe code i provided should work across the entire site – as long as they all have a header element.
If you wanted to target specific parts of the site then you can you keep your code and add some additional conditional tags.
https://codex.wordpress.org/Conditional_Tags
e.g this line:
if ( is_page() ) {
is just Pages.Whereas this:
if ( is_home() ) {
is just the Blog Page ( Thats when the Blog is static page NOT the front page.And this:
if ( is_home() || is_single() ) {
is the Blog Page OR the single posts.You can string as many as you like or use the
!
not statement.So this:
if ( ! is_home() ) {
would be everywhere except the Blog PageHope that helps
July 31, 2020 at 1:23 pm #1383419DanielYes, thanks again for the great support.
July 31, 2020 at 1:25 pm #1383422DavidStaffCustomer SupportGlad to be of help
-
AuthorPosts
- You must be logged in to reply to this topic.