Remove class in nav_menu_link_attibutes filter

Let us first look at this part: I don’t exactly understand what object $item is and this is probably the problem. When I call get_class() on $item I get WP_Post, but WP_Post does not have a classes property. So how is $item->classes returning an array of classes? Few notes regarding the structure of menus in … Read more

How to insert HTML/JavaScript form into WordPress page? [closed]

You have a bunch of issues: 1. WordPress part: Your function is hooked to wp_enqueue_scripts and should be like this: function wpse238953_calculate() { wp_enqueue_script(‘calculate’, plugins_url(‘/js/calculate.js’), __FILE__), array(‘jquery’), false); } add_action(‘wp_enqueue_scripts’, ‘wpse238953_calculate’); Note the different spellings between wp_enqueue_scripts and wp_enqueue_script 2. The HTML/JS part: Let’s add some id to the two input fields so that it’s … Read more

Secondary navigation menu on one page

If you need this menu on one page only, let’s say About Us (slug: about-us), you can easily add a conditional like this in pages.php at the place where you want the menu to appear: if (is_page(‘about-us’)) { wp_nav_menu( array( ‘theme_location’ => ‘secondary-menu’, ‘menu_class’ => ‘secondary’, ‘fallback_cb’ => ” )); } Remember that if you … Read more