Giter Club home page Giter Club logo

wordpress-bem-menu's People

Contributors

roryashfordbentley avatar vincentorback avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-bem-menu's Issues

BEM Naming Convention & nested elements

I wanted to bring up an issue more for the sake of discussing the best practice, and getting opinions.

The default for sub-menus, Wordpress-Bem-Menu nests elements, which I think is frowned upon. So we have classes like:

.menu (block)
-- .menu__item (block__element)
-- -- .menu__sub-menu (block__element)
-- -- -- .menu__sub-menu__item (block__element__element)

IMO, I think it would be more inline with BEM methodology to either split sub-menu into its own block, with its own elements (i.e. .sub-menu__item), or make being a sub-menu a modifier, and leave the elements in it the same as for the parents:

.menu (block)
-- .menu__item (block__element)
-- -- .menu--sub-menu (block--modifier)
-- -- -- .menu--sub-menu .menu__item (block--modifier block__element)

I think the latter is the more sensible solution, as a "sub menu" isn't really a block-level item, as it cannot exist outside of the menu. The fact that it is "sub" is just a modification of the menu, the element structure is the same.

Other than some minor tweaking of the item_css_class_suffixes array (with no good affect), I haven't looked closely at how the code would need to be modified to accommodate something like this -- or even if it is possible. I thought I'd mention it all the same though, as I really like this project.

More explanation required

Hi, new to WP so struggling a little with getting this working - would it be possible to give some more detailed installation/implementation instructions? Currently getting 'You need to first define a menu in WP-admin' and unsure how to resolve.

Thanks!

You need to first define a menu in WP-admin

This is, no doubt, an issue with my misunderstanding but...

I've pasted the relevant php into my functions.php and that seems to run smoothly.
I've set menu location in wp-admin > 'primary'.
I've added <?php bem_menu('primary', 'nav'); ?> into my header.php.

But I get - "You need to first define a menu in WP-admin" when I load up a page to see what happens.

Any ideas as to what I'm doing stupidly wrong?

Add argument for parent modifier

I recently encountered a situation where I needed to add a modifier to the BEM menu <ul> but the modifier did not need to be added to children.

an example:

<ul class="main-menu  main-menu--secondary">
    <li class="main-menu__item"><a href="#">Page 1</a></li>
    <li class="main-menu__item"><a href="#">Page 2</a></li>
    <li class="main-menu__item"><a href="#">Page 3</a></li>
</ul>

I propose adding an implementation along these lines:

<?php bem_menu( 'my_menu', 'main-menu', array('main-men--secondary','main-menu--something-else') ) ?>

I think that having the last argument accept an array allows for a lot more flexibility but it keeps the code really lean.

Add Composer.json file for packagist

I'm using Composer a lot these days to bring vendor code such as this into my WordPress theme. I was wondering if it'd be possible to add a composer.json file to allow this to occur?

How add two or more menu

How can I add two or more menu if each of them should be an another block with a few changes in html structure?
For example top-nav, top-nav__item ... and footer-nav, footer-nav__item

Classes on links?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.