Replace a menu with widget or a custom template file programmatically

You can modify the arguments passed to wp_nav_menu with a filter called wp_nav_menu_args. You can use this filter to add a walker class, which will modify the behaviour of wp_nav_menu.

This approach is kind of hackish, because the walker class will still ‘walk’ through all the menu items, but you can control them, so decide not to output any item. Here’s a nice tutorial on the walker class.

Inside your walker class you can include your custom content. Note that you’ll need to add html, as PHP code will not be evaluated anymore.