Skip to content

Instantly share code, notes, and snippets.

@mirkoschubert
Last active August 29, 2015 14:23
Show Gist options
  • Save mirkoschubert/ea70af215a18de691279 to your computer and use it in GitHub Desktop.
Save mirkoschubert/ea70af215a18de691279 to your computer and use it in GitHub Desktop.
WordPress Footer Navigation as String
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