WP Manifestindependent plugin directory
manifest / performance / set-menu

Set Menu

Cached menu for WordPress

by Kunoichi INC. · github.com/kuno1/set-menu · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/kuno1/set-menu/archive/refs/heads/master.zip

Readme

Set Menu

Cached menu and widgets for WordPress.

Installation

Use composer with your theme.

composer require kunoichi/set-menu

How to Use

Step 1: Initialization

Enable in your functions.php


reuqire __DIR__ . '/vendor/autoload.php';
Kunoichi\SetMenu::enable();

Step 2: Enable Cached Menu

Replace yoru wp_nav_menu to Kunoich\SetMenu::nav_menu. Checking with has_nav_mehu is recommended.

if ( has_nav_menu( 'header'  ) ) {
    Kunoichi\SetMenu::nav_menu( [
        'container'      => false,
        'menu_class'     => 'footer-social-menu',
        'depth'          => 1,
        'theme_location' => 'social-menu',
    ] );
}

Step 3: Enable Cached Widgets

Replace your dynamic_sidebar to Kunoichi\SetMenu::sidebar.

<footer class="footer">
    <?php if ( is_active_sidebar( 'footer-widgets' ) ) : ?>
        <div class="container">
            <div class="row" id="footer-widgets">
                <?php Kunoichi\SetMenu::sidebar( 'footer-widgets' ); ?>
            </div>
        </div>
    <?php endif; ?>
</footer>

Step 4: Check the settings

Setting page is added within wp-admin, and it can be accessed via "Appearence > Theme Cache Setting".

If you need to change the default values, you can do it here.

  • Navigation Menu Caching
    • Dynamic menu locations to exclude from caching
    • Cache lifetime (default is 60 min.)
  • Widget Caching
    • Dynamic sidebars to exclude from caching
    • Cache lifetime (default is 60 min.

Customization

Filters

set_menu_default_ignored_locations

set_menu_default_menu_lifetime

set_menu_default_sidebar_lifetime

License

GPL 3.0 or later.

Read the full README on GitHub →