I had a simmilar need, so I came up with this. It uses i18n plugin's navigation API functions.
Put this function in your theme's functions.php file, then call it from your template file like this: <?php custom_tree_nav(); ?>
It will create the raw HTML menu code. Be aware that no checks are made whether a page is empty or not, rather a page is checked for existence of children. Also, no attempt was made to recreate the url structure, as GS will (with proper configuration) accept anything after the last slash as a page slug, and return the correct page.
Any CSS styling + JS behavior is up to you.
PHP Code:
function custom_tree_nav( $current_slug = null, $entries = false )
{
$current_slug = $current_slug ? $current_slug : get_page_slug( false );
if( !$entries )
$entries = return_i18n_menu_data( $current_slug, 0, 99, I18N_SHOW_MENU );
echo '<ul>';
foreach( $entries as $entry )
{
# 'current' menu entry class tag.
$current = $entry['current'] ? ' current' : '';
# Get menu name, or page name if menu name empty.
$menu = $entry['menu'] ? $entry['menu'] : $entry['title'];
# This may need to be adjusted according to installation specifics
$slug = '/'.$entry['url'];
$url = $entry['url'];
if( !empty( $entry['children'] ) )
{
# Might want to throw an 'a' instead of 'span'.
echo '<li><span class="'.$url.$current.'">'.$menu.'</span>';
custom_tree_nav( $current_slug, $entry['children'] );
echo '</li>'."\n";
}
else
echo '<li><a class="'.$url.$current.'" href="'.$slug.'" target="_self">'.$menu.'</a></li>'."\n";
}
echo '</ul>'."\n";
}
Put this function in your theme's functions.php file, then call it from your template file like this: <?php custom_tree_nav(); ?>
It will create the raw HTML menu code. Be aware that no checks are made whether a page is empty or not, rather a page is checked for existence of children. Also, no attempt was made to recreate the url structure, as GS will (with proper configuration) accept anything after the last slash as a page slug, and return the correct page.
Any CSS styling + JS behavior is up to you.