I overslept and came to a completely different solution with the same visual outcome. It simply doesn’t use additional div
in the li
elements and p
elements in the a
element. The jsfiddle shows the solution thanks to the Keith J. Grant’s idea I encountered. So instead of WordPress I honed a bit my CSS skills.
But actually, the question remains: how to insert an arbitrary markup into a certain existing menu (in my case the primary menu of the chosen theme). That is into each menu item li
and then into each link a
, preserving the menu’s URLs.