Archived topic
Add custom code to secondary nav bar
3 replies · Started by Camilo Luna on July 29, 2022
Hi GP team,
I've been trying to add a Multicurrency Switcher from WPML to the Secondary Nav but haven't found the best way to do it.
Is there a hook/action I can use? Or is there a template file I can override on my Child Theme for modifying it?
Here's what I'm trying to add: https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/#currency-switcher-as-php-code
Thanks!
Hi there,
It looks like you can use a shortcode as well, in that case, add the shortcode to a hook element, and tick the execute shortcode box.
https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/#currency-switcher-shortcode
If you have to use PHP code, do the same, but tick the execute PHP box instead. Wrap the code with <?phpand ?>
Here's a GP hook visual guide:
https://docs.generatepress.com/article/hooks-visual-guide/
Hi @Ying,
Sorry for the late reply. I finally was able to come back to this project and successfully used the generate_inside_secondary_navigation hook for what I needed. From the image in the hooks page I first wrongly assumed the action happened before the secondary navigation, but from the name it actually was inside.
Thanks again!
You are welcome :)