- This topic has 23 replies, 3 voices, and was last updated 7 years ago by
Leo.
-
AuthorPosts
-
May 21, 2019 at 12:03 pm #907073
Leo
StaffCustomer SupportConditional tag shouldn’t have caused that.
Where can I see the issue?
The page you linked has ID 3914 which isn’t included in the conditional tag.
May 21, 2019 at 12:17 pm #907088Sebastien
I’ve linked the page ID: 36
as you see, the hook secondary nav bar is displayed under top bar. It also happens on pages that are not included in the conditional function.
May 21, 2019 at 12:22 pm #907091Leo
StaffCustomer SupportHmm weird.
I noticed that there is double
;after this line:
add_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 15 );;Can you fix that and see if it makes a difference?
May 21, 2019 at 12:26 pm #907096Sebastien
I’ve edited as suggested, but nothing changes. The code is now :
add_action( 'after_setup_theme','lh_move_secondary_navigation' ); function lh_move_secondary_navigation() { if ( is_page( array( 4536, 4537, 36, 4538, 4534, 4535 ) ) ) { remove_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 7 ); add_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 15 ); } }May 21, 2019 at 12:29 pm #907099Leo
StaffCustomer SupportTry this:
add_action( 'wp','lh_move_secondary_navigation' ); function lh_move_secondary_navigation() { if ( is_page( array( 4536, 4537, 36, 4538, 4534, 4535 ) ) ) { remove_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 7 ); add_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 15 ); } }May 21, 2019 at 12:36 pm #907113Sebastien
Ok this one works thanks.
But If the conditon is not validate, I would like the second nar bar been hidden.May 21, 2019 at 12:41 pm #907119Leo
StaffCustomer SupportTry this:
add_action( 'wp','lh_move_secondary_navigation' ); function lh_move_secondary_navigation() { if ( is_page( array( 4536, 4537, 36, 4538, 4534, 4535 ) ) ) { remove_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 7 ); add_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 15 ); } else { remove_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 7 ); } }May 21, 2019 at 12:49 pm #907123Sebastien
Thanks you so much Leo !! it works =)
Just for information: does this kind of php conditional add any delay in the page load performence?thanks byee =)
May 21, 2019 at 12:58 pm #907133Leo
StaffCustomer SupportShould be minimal.
Glad we could help 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.