Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.
/ themosis-menu Public archive

A package to make working with menus easier.

License

Notifications You must be signed in to change notification settings

djgadd/themosis-menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Themosis Cache

A package to make working with menus easier. Requires keltiecochrane/themosis-illuminate and keltiecochrane/themosis-cache to be setup for collections and caching. Will build menus from source and cache them "forever", will clear the menu from cache if it's updated/deleted.

Install

Install through composer: - composer require keltiecochrane/themosis-menu

Register the service provider in your theme/resources/config/providers.php file: - KeltieCochrane\Menu\MenuServiceProvider::class,

Optionally register the alias in your theme/resources/config/theme.php file: - 'Menu' => KeltieCochrane\Menu\MenuFacade::class,

Examples

  $menu = Menu::getByLocation('header-nav');
  $menu->name; // The menu's name
  $menu->each(function ($item) {
    $item->children; // The menu items children
    $item->descendants; // A collection of IDs for all this items descendants
    $item->active; // Boolean indicating whether this item is the current page/post/etc.
    $item->active_descendant // Boolean indicating whether a descendant is active

    // Plus all the usual WP_Post fields
  });

See the Laravel docs for more info.

Helpers

The following (additional) helpers are available: -

  • getMenuById(int $menuId, int $activePostId = null)
  • getMenuByLocation(string $location, int $activePostId = null)

To Do

  • Testing

Support

This plugin is provided as is, though we'll endeavour to help where we can.

Contributing

Any contributions would be encouraged and much appreciated, you can contribute by: -

  • Reporting bugs
  • Suggesting features
  • Sending pull requests

About

A package to make working with menus easier.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages