roryashfordbentley/Wordpress-Bem-Menu

Classes on links?

Closed this issue · 6 comments

First -- this is excellent, thanks for this! I'm looking to BEM-ify my themes, and this was a huge help.

Just wondering if you've any plans for adding BEM classes to the menu links. I realize .menu__item a works just fine, but had thought using classes over elements was a better practice, and so something like .menu__link would be more appropriate.

Either way, thanks again. Super helpful.

Thanks for the kind words!

I love seeing how people use this and to be honest I hadn't considered adding classes to the links. I originally didn't add classes to links to keep the output light but it wouldn't add too much bloat and the change wouldn't affect existing installs either.

Once I find some time I will create a PR and update this so it can be tested.

Should be added now: 5b4e1b3

Hey Rory, I just gave this a shot. I see the new classes on the sub-menu links, but the top-level links just have a blank class="".

Included the source functions verbatim, and don't believe I have anything going on that would modify that. Will dig a little deeper into the source and see, in case it's a local problem to my theme.

I see the issue, It seems I was a bit hasty with the last PR. I'll reopen the issue and get this fixed :D

@nocean I have updated the code to hopefully rectify any further issues with link classes. Give it a try and let me know if there are any further issues.

67602cf

@roikles -- just tested and it works like a charm!