@Emil and @willshouse Thank you. Tested both of your solutions to remove <ul> and </ul> from wp_nav_menu and both worked. Thanks to @Scolpy for starting this topic :-)
I wanted to update a theme currently used in a live installation to implement wp_nav_menu but fall back to wp_list_pages and use existing styling I had in my theme's style.css for elements within <div id="navbar"> and <ul id="nav">
To summarize one solution where I can easily spot what needs to be changed later on:
In functions.php
// register wp_nav_menu
add_action( 'init', 'register_my_menus' );
function register_my_menus() {
register_nav_menus( array(
'primary-menu' => __( 'Primary Menu', 'mytheme' )
)
);
}
// remove ul wp_nav_menu
function remove_ul ( $menu ){
return preg_replace( array( '#^<ul[^>]*>#', '#</ul>$#' ), '', $menu );
}
add_filter( 'wp_nav_menu', 'remove_ul' );
In header.php
<div id="navbar">
<ul id="nav">
<?php if ( has_nav_menu( 'primary-menu', 'mytheme' ) ) { ?>
<?php wp_nav_menu( array( 'container' => false, 'theme_location' => 'primary-menu', 'fallback_cb' => 'display_home' ) ); ?>
<?php } else { ?>
<li><a href="<?php echo get_option('home'); ?>">Home</a></li>
<?php wp_list_pages('title_li=&depth=4&sort_column=menu_order'); ?>
<?php } ?>
</ul>
</div>
Found in trac - Add ability to remove ul tag from wp_nav_menu result
Another way using second - http://wordpress.stackexchange.com/questions/7968/how-do-i-remove-ul-on-wp-nav-menu
Cheers.