-
Notifications
You must be signed in to change notification settings - Fork 870
Adding Custom Attribute To Menu Item to open modal #190
Comments
You will get better support for this on the Wordpress forum as this a core Looking at the demo I can see that each li in the menu already and an |
I'm trying to assign, data-reveal-id="myModal" to a menu item in wordpress. This is built in in foundation, but unfortunately adding custom attributes to menu items isnt in wordpress. I would have guessed that someone on here already ran into this problem and had a solution but after searching I couldn't find anything. |
This is a bit beyond me but I would suggest extending the WP Menu function... http://jamescollings.co.uk/blog/wordpress-custom-walker-output-section-of-menu/ |
You would need to modify the menu walker to add classes and extra attr, so I would start there. (library\menu-walker.php) If you want to be able to change what you add you can start with a plugin that adds custom attributes to the menu items and then call it from the menu walker. I found these articles that may help: http://wordpress.stackexchange.com/questions/103345/wp-nav-menu-add-attributes-to-menu-items |
Hi and thanks for providing such a great theme. I am struggling to understand how I would add a custom attribute to a menu item in wordpress so that when I click contact in my menu, it opens a modal instead of going to a page. I think the answer lies here somewhere: http://codex.wordpress.org/Plugin_API/Filter_Reference/nav_menu_link_attributes but I can't figure out how to implement it. Any help would be much appreciated. Specifically where should these different chunks of code go, and what do I need to edit for it to work with the foundationpress top bar?
Thanks!
The text was updated successfully, but these errors were encountered: