In recent work where I’ve been using tailwindcss to build my UI, I’ve come up against the challenge of dealing with WordPress’ default menu markup. One possible solution here could be to write a custom walker class but, for something quick and simple, the following code snippet got me where I needed to be with less headache.
This approach is also great for printing a WordPress menu as nothing but
<a> tags which is really useful when dealing with things like footer links. It makes it quick and easy to print the simplest of markup whilst still leveraging WordPress’ menu system to control the menu from the admin.
If you liked this article, I'd be incredibly grateful if you tweeted about it.
Also, I don't send emails often but when I do, I try to fill them full of useful goodies. If you like code snippets & dev tips, join my mailing list. There's no catch but I'll probably want to tell you about any new plugins & tools I build.