Cached menu and widgets for WordPress.
Use composer with your theme.
composer require kunoichi/set-menu
Enable in your functions.php
reuqire __DIR__ . '/vendor/autoload.php';
Kunoichi\SetMenu::enable();
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',
] );
}
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>
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.
GPL 3.0 or later.