Which theme and a link to the website would help, the menu could be theme dependent.
Do you want just to tidy the code, or make the menu conditional?
If inside the header.php there is a call to wp_nav_menu() then you might be able to deal with this with an empty callback.
For more tidy code you could also add the menu block to a template part, but it is not clear why you want to do this, but here is what I would do in a twenty eleven theme child theme.
I would copy the header.php to the child theme, and then copy this block of code to a file called navigation-main.php
<nav id="access" role="navigation">
<h3 class="assistive-text"><?php _e( 'Main menu', 'twentyeleven' ); ?></h3>
<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
<div class="skip-link"><a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to primary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?></a></div>
<div class="skip-link"><a class="assistive-text" href="#secondary" title="<?php esc_attr_e( 'Skip to secondary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?></a></div>
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav><!-- #access -->
And replace it with:
<?php get_template_part('navigation','main'); ?>
This is just a cleaner way of coding, look at the files in twenty eleven and you will see it is used a lot now.
As an example I added two extra menus to a theme and used template parts to minimise the changes to the existing files.
HTH
David
David, thanks very much. That’s really appreciated.
It’s helped me to better understand WP.
The particular theme is an adapted variant of ‘Fresh and clean’, and following your template suggestions things are now as I want.
My reason was to tidy the code, although I can now see how I can use this conditionally should the need arise.