Last active
August 29, 2015 14:23
-
-
Save mirkoschubert/ea70af215a18de691279 to your computer and use it in GitHub Desktop.
WordPress Footer Navigation as String
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
if (!function_exists('theme_footer_menu')) : | |
function theme_footer_menu($args = array('theme_location' => 'secondary', 'seperator' => '•')) { | |
$args['seperator'] = ($args['seperator'] != '') ? ' ' . $args['seperator'] . ' ' : ' '; | |
if ($args['theme_location'] == '') { | |
return false; | |
} else { | |
if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args['theme_location'] ] ) ) { | |
$menu = wp_get_nav_menu_object( $locations[ $args['theme_location'] ] ); | |
$menu_items = wp_get_nav_menu_items($menu->term_id); | |
$menu_string = ''; | |
foreach ( (array) $menu_items as $key => $menu_item ) { | |
$menu_string .= $args['seperator'] . '<a href="' . $menu_item->url . '">' . $menu_item->title . '</a>'; | |
} | |
echo $menu_string; | |
} | |
} | |
} | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment