underpin / menu-loader
Menu loader for Underpin
1.1.0
2021-11-24 21:33 UTC
Requires
- underpin/underpin: ^2.0
This package is auto-updated.
Last update: 2024-11-25 04:49:20 UTC
README
Loader That assists with adding navigation menus to a WordPress website.
Installation
Using Composer
composer require underpin/menu-loader
Manually
This plugin uses a built-in autoloader, so as long as it is required before Underpin, it should work as-expected.
require_once(__DIR__ . '/underpin-menus/menus.php');
Setup
- Install Underpin. See Underpin Docs
- Register new menus as-needed.
Example
A very basic example could look something like this.
// Register menu underpin()->menus()->add( 'example-menu', [ 'name' => underpin()->__( 'translate-able name' ), // required. Fills "description" in register_nav_menu 'location' => 'example-menu' // Required. See register_nav_menu ] );
Alternatively, you can extend Menu
and reference the extended class directly, like so:
underpin()->menus()->add('menu-key','Namespace\To\Class');