Last active
June 29, 2018 13:46
-
-
Save odil-io/462a57b089dcf73fa444eb2f14daef61 to your computer and use it in GitHub Desktop.
WordPress: List Menu items, does NOT work with WP Nav Plus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $locations = get_nav_menu_locations(); ?> | |
<?php $menu = wp_get_nav_menu_object( $locations['theme_location'] ); ?> | |
<?php $menu_items = wp_get_nav_menu_items( $menu->term_id ); ?> | |
<ul class="list-group list-group-flush"> | |
<?php foreach ( (array) $menu_items as $key => $menu_item ): ?> | |
<li class="list-group-item list-group-item-action"> | |
<a href="<?= $menu_item->url; ?>"> | |
<?= $menu_item->title; ?> | |
</a> | |
</li> | |
<?php endforeach; ?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment