wp_page_menu different classes
-
I am using the wp_page_menu funtion in my WordPress theme to display a site’s page menus. The code looks like: https://pastebin.com/9Sa6jTnG
The code works great…but what I wanted to do was set a class and id (for implementing menus) on the ul tag, the wp_page_menu function doesn’t let you do that, but I did find some code that I added to my functions.php file which looks like: https://pastebin.com/2frXmyHL
This function works, however I am using wp_page_menu in two places and I only want the functions code to be added to the first instance of wp_page_menu. I did some searching and found this piece of code: https://themeshaper.com/forums/topic/second-wp_page_menu-with-different-classes
I tweaked the code (https://pastebin.com/GVU9wLT2), but regardless of where I add it in my function, it doesn’t seem to do anything.
Is the code correct? If so, did I incorrectly tweak the code? If not, where should the line be added for the code to work properly?
Any ideas?
Thanks,
Josh
- The topic ‘wp_page_menu different classes’ is closed to new replies.