Download the PHP package sjmaceyful/bem-nav-walker without Composer

On this page you can find all versions of the php package sjmaceyful/bem-nav-walker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package bem-nav-walker

Wordpress BEM Menu

Packagist

Say goodbye to badly named menus in Wordpress and say hello to Wordpress BEM Menus!

This is fork of Wordpres-Bem-Menu, we only changed structure and added it to packagist for composer installs.

Instalation

To use simply drop the contents of src/wp_bem_menu.php into your functions.php file.

Download src/wp_bem_menu.php and save it to your theme folder. In functions.php use include for this file.

Composer way

Use cmd and navigate to your themes folder. Then use this command:

and don't forget to include composer's autoload from functions.php

Usage

First you need to register a nav menu in your themes functions.php file.

register_nav_menu('my_menu', 'primary site menu');

You also need to create a menu in wp-admin and make sure it is assigned a theme location that matches your registered nav menu above.

Then insert the following function into your theme. The first argument is the theme location (as defined in wp-admin) and the second argument is the class prefix you would like to use for this particular menu. The class prefix will be applied to the menu <ul>, every child <li> and <a> as the 'block'. The third optional argument accepts either an array() or a string.

If you want to add multiple modifiers to the <ul> use an array e.g:

Please note that these modifier classes are not inherited by descendants. this is by design to avoid bloated navigation markup. You can still target children of a specific modifier like so: .my-menu--my-modifier .my-menu__item{}

html output

Css classes

The syntax is very simple, all menu items are logically grouped by depth to avoid some of the nesting issues of the standard output.

Modification

BEM syntax is very subjective and different developers use different conventions. If you wish to change or adapt the syntax to go with your own implemntation all the menu suffixes are contained within the $this->item_css_classes array:

Custom Css classes set in wp-admin>menus

If you add a custom class to a menu item in wp-admin Wordpress-Bem-Menu now adds the class to the item converted to a BEM modifier. If for example you add a class of my-class to a menu item the output would be <li class="main-menu main-menu__item main-menu__item--my-class"></li>


All versions of bem-nav-walker with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sjmaceyful/bem-nav-walker contains the following files

Loading the files please wait ....