Add code to WordPress menu items by class

So yes, by far you should use the new event handlers instead of adding attributes to your html tags. (so your second method, in the footer) The reason your footer code didn’t work is because you didn’t quite figure out how to transfer from the attribute to the handler form… When you say onclick=”toggle_visibility(‘sub-menu’);” the … Read more

Child page menu in sidebar

When trying to output a function’s content, you have to notice whether you want to pass the data to another function (or something else which you want to feed), or you want to directly print it to the browser. If you use return, your function will return the data, so you can use them in … Read more