I found a way to make it work.
I had to put: <?php wp_enqueue_script('jquery'); ?>
before
<?php wp_head(); ?>
and then the jquery code.
If there is a better, clean way, please let me know.
Related Posts:
- Merge two separate WP menus into one in Mobile view
- Add class to menu ul with active child
- jQuery cookie not working properly in wordpress
- Create search form in menu as in Twenty Fourteen theme
- Hide menu item in certain condition
- Hierarchical menu nesting problem with jQuery targetting
- superfish.js seems it is not working properly after wordpress upgarde to 4.6.1
- Adding numbers inside a span tag in nav menu [closed]
- Adding toggle-able element after menu item
- WordPress Menu adds an unwanted slash before anchor
- Twenty Fifteen: Change navigation menu behavior
- Drop Down menu expanded by default (on front page) [closed]
- WordPress Menus – How to add inline styles to UL menus
- WP Menu Rollover Nav Item and Effect DIV Elsewhere
- Menu item that hides when you click the previous submenu
- Add class to sub-menu from unrelated element
- Cannot collapse a responsive menu in WordPress
- Add “onclick” option to header menu item
- calling JS to custom menu design
- how do you create this customize menu using wp_nav_menu function?
- Mobile menu not working – jQuery error?
- Walker or wp_get_nav_menu_items VS jQuery
- show a hidden ul if li is active
- Foundation Scripts not loading (custom theme)
- Links in new menu don’t work
- jQuery not working when used with wordpress menu
- Jquery dropdown menus working locally, but not in WordPress [duplicate]
- Is it possible to animate the Twenty Eleven menu? [closed]
- Is there an easy way to replace a custom menu link with a page or post?
- Why do Custom Nav Menus generate so many classes on list items? Can I manage this somehow?
- Using nonce in menu item
- How show sub menu only using wp_nav_menu()
- Custom Nav Walker menu – Display children count
- How to add menu to Dashboard that can be viewed by all users
- List children of second level sub page
- Show top-level parent with submenu menu walker
- How to display custom post meta in the appearance->menus page
- wp_nav_menu custom walker – child items
- Adding menu items dynamically using wp_nav_menu_objects
- BuddyPress – How to add logout in nav menu
- Where do custom menus get constructed?
- How to remove div container in custom menu?
- How can I access the menu ID of an element in a WordPress Nav_Walker
- How to translate menu items?
- echo same menu items across multi-site platform
- Custom Menu url is Empty
- Show Home Link In wp_nav_menu but only on primary menu
- Add active class to top-level menu items when viewing single for that post type
- How to use buttons elements for tgetWordPress menu items?
- automatically append menu parent as first item in submenu with nav_walker
- Add active class to ul container menu
- Help with walker for nav
- API for wp menu hacks
- wp_list_pages sort order by custom nav menu order
- Displaying Nav Menu
- WP admin style not refreshing
- How to test if a specific page is the front page?
- login logout menu changes in wordpress [closed]
- Style wp_link_pages as a select drop down list
- Menu deletes all items and position – wordpress bug?
- Mobile navigation is shown, but standard navigation does not disappear
- Plugins & Setting Menu Items Removed From Admin Panel
- Responsive menu on genesis theme [closed]
- Question about Menus on WordPress
- Controlling sub-menu within sub-menu
- Main menu navigation links and new pages
- Bootstrap menu – make menu entries with submenu not clickable
- How are methods of class Walker_Nav_Menu invoked?
- Duplicate menu items when auto generating menu from product categories
- Using menus to link to sections on the home page
- Multisite: menus can’t be added in child sites
- Is it possible to remove the highlighted menu on Users and highlight a different menu?
- Modifying Woocommerce menu based on tags and categories
- How To add this tag before drop-down ul. in wordpress
- Unable to get Navigation Menu to display in the desired location
- WordPress theme editor not showing
- How to switch menu location in this header.php?
- Why does WordPress convert absolute URLs to relative URLs for menu items?
- Enable identical menu on network sites
- Adding a menu item to the main menu
- wp_is_mobile() inside js
- Adding two same css class on menu item
- How to select single category in menu if post have two categories?
- menu is only pulling in one item
- Any reason why widgets/menus get emptied when I updated custom theme code?
- Add items to a menu
- How to change page location in WordPress
- Use menu structure for permalinks
- how to keep theme background image, menu or site header image while moving site in sub directory?
- Unable to edit Navigation bar
- Editor user only allow to post on certain categories
- Menu Underline shows without Hover after adding subitems
- Add class to current category menu item
- How to create a custom WordPress navigation menu?
- Should I custom code drop down menus or use a wordpress plugin?
- How to load css file in my menu in wordpress
- Navigation menu, remove item from desktop
- Wrapping my ‘s with
- child theme font awesome icons not working
- How to replicate a mobile menu from a site to a wordpress site [closed]