So this is the basic template page code:
<?php
/*
* Template name: About Content Template
*/
?>
<?php get_header(); the_post(); ?>
<div id="container">
<div id="main-content" class="dropShadow roundEdge">
<?php wp_nav_menu( array('menu' => 'About Submenu', 'menu_id' => 'submenu', 'container' => 'false' )); ?>
<?php the_content(); ?>
</div>
<?php get_sidebar();?>
</div>
<?php get_footer();?>
For simplicity, let’s say that the only thing that changes is the menu name, depending on the page group. The page groups are e.g. About and Products. The first thing that comes to mind is to add a custom field to each page that belongs to a group and set a property "category=About" or "category=Products". In the functions.php I would have an array of category names mapped to the menu name, e.g. "About = About Menu", so before loading the menu, I’d get the custom property, read the menu name value from the array and set it as an argument to the wp_nav_menu function. Is there a more elegant way to do this?
The solution I found is relatively simple. The first page in the submenu (eg. History when you press About) can be viewed as the category main page, so I took all the other pages that are linked in the submenu and put the first page (History) as their parent. Then I created a submenu through the dashboard and called it History submenu. The code that makes this work is simple:
get_the_title gets either the parent page name or, if there’s no parent, the page name. Though not much different than using custom fields, I think it’s more elegant sin