- This topic has 7 replies, 2 voices, and was last updated 6 years, 1 month ago by Leo.
-
AuthorPosts
-
January 15, 2018 at 4:49 am #471254Ezekiel
Hi
Please, how can I show logo on secondary navigation on other pages and not on the homepage?Thank you for your help.
Ezekiel.
January 15, 2018 at 8:15 am #471469LeoStaffCustomer SupportHi there,
You can use this hook:
https://docs.generatepress.com/article/generate_inside_secondary_navigation/and exclude the home page:
https://docs.generatepress.com/article/using-hooks-conditional-tags/#static-front-pageExample: https://generatepress.com/forums/topic/logo-in-secondary-menu/#post-362491
January 29, 2018 at 4:36 am #482375EzekielHi Leo,
Thank you for the response it really helped, but I am a bit confused as to how to exclude the home page. this is what I did but it crashed my website;
<?php if ( ! is_front_page() ) : ?> add_action( 'generate_inside_secondary_navigation','add_secondary_navigation_logo' ); function add_secondary_navigation_logo() { ?> <div class="secondary-navigation-logo"> <img src="http://projectsamng.com/wp-content/uploads/2018/01/Secondary-Menue-Logo.png" alt="" /> </div> <?php } <?php endif; ?>
I don’t know PHP but I am trying my best.
Ezekiel.
January 29, 2018 at 10:47 am #482754LeoStaffCustomer SupportTry this instead:
add_action( 'generate_inside_secondary_navigation','add_secondary_navigation_logo' ); function add_secondary_navigation_logo() { ?> <?php if ( ! is_front_page() ) : ?> <div class="secondary-navigation-logo"> <img src="http://projectsamng.com/wp-content/uploads/2018/01/Secondary-Menue-Logo.png" alt="" /> </div> <?php endif; ?> <?php }
January 29, 2018 at 11:20 am #482787EzekielHi Leo,
Thank you for the response, I tried it but I keep getting this message;
Don’t Panic
The code snippet you are trying to save produced a fatal error on line 7:syntax error, unexpected ‘endif’ (T_ENDIF)
The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.
January 29, 2018 at 2:43 pm #482990LeoStaffCustomer SupportSorry made a mistake.
It should work now 🙂
February 1, 2018 at 3:16 am #485213EzekielHi Leo,
Thank you so much. Is it possible to keep the secondary bar on the home page and hide only the logo.
Ezekiel R.
February 1, 2018 at 9:10 am #485566LeoStaffCustomer SupportNot sure what you mean? The code I provided should’ve added the logo only everywhere except home page.
-
AuthorPosts
- You must be logged in to reply to this topic.