https://github.com/underpin-wp/admin-bar-menu-loader
Loader for Admin Menu Bars
https://github.com/underpin-wp/admin-bar-menu-loader
admin-bar underpin wordpress
Last synced: about 1 month ago
JSON representation
Loader for Admin Menu Bars
- Host: GitHub
- URL: https://github.com/underpin-wp/admin-bar-menu-loader
- Owner: Underpin-WP
- Created: 2021-05-02T22:59:57.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-24T21:29:46.000Z (over 4 years ago)
- Last Synced: 2025-03-08T01:01:52.237Z (over 1 year ago)
- Topics: admin-bar, underpin, wordpress
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Underpin Admin Bar Menu Loader
Loader That assists with adding admin bars menus to a WordPress website.
## Installation
### Using Composer
`composer require underpin/loaders--admin-bar-menus`
### 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-admin-bar-menus/underpin-admin-bar-menus.php');`
## Setup
1. Install Underpin. See [Underpin Docs](https://www.github.com/underpin-wp/underpin)
1. Register new admin menus as-needed.
## Admin Menu Example
A very basic example could look something like this.
```php
\Underpin\underpin()->admin_bar_menus()->add( 'menu_bar_key', [
'children' => [],
'capability' => 'administrator',
'id' => 'menu_bar_id', // Required
'args' => [ /* See WP_Admin_Bar::add_menu */ ],
'position' => 200,
'name' => 'Menu Bar',
'description' => 'A menu bar example',
] );
```
Alternatively, you can extend `Admin_Bar_Menu` and reference the extended class directly, like so:
```php
underpin()->admin_bar_menus()->add('menu_bar-key','Namespace\To\Class');
```