ThemePlate menu iterator

v1.0.0 2021-02-21 07:51 UTC

This package is auto-updated.

Last update: 2024-10-21 17:03:52 UTC


README

use ThemePlate\menu;

$primary_menu = new Menu( 'primary' );

$primary_menu->get();
$primary_menu->get_id();
$primary_menu->get_name();
$primary_menu->get_slug();
$primary_menu->get_count();
$primary_menu->get_items();
<ul id="menu-<?php echo $primary_menu->get_id(); ?>" class="<?php echo $primary_menu->get_slug(); ?>">
	<?php foreach ( $primary_menu->get_items() as $menu_item ) : ?>
		<li class="<?php echo implode( ' ', $menu_item->classes ); ?><?php echo $menu_item->is_active ? ' active' : ''; ?>">
			<a href="<?php echo $menu_item->url; ?>"><?php echo $menu_item->label; ?></a>
		</li>
	<?php endforeach; ?>
</ul>