Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6185441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:42:42+00:00 2026-05-24T01:42:42+00:00

So this is the basic template page code: <?php /* * Template name: About

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:42:43+00:00Added an answer on May 24, 2026 at 1:42 am

    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:

    <?php $submenuName = get_the_title($post->post_parent);
            $submenuName = $submenuName . " Submenu";
            wp_nav_menu( array('menu' => $submenuName, 'menu_id'  => 'submenu',  'container' => 'false' ));
    

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this code to load the content from a different page into the
This is a really basic question but... I have some code like this var
I got the following very basic template: <html> <head> </head> <body> <div> <!-- Using
Consider the following simplified version of my code. I have a template class A
This is basic stuff, but I'm somewhat unfamiliar with VBA and the Word/Access object
So this seems pretty basic but I can't get it to work. I have
I know this maybe a basic question but I just can't seem to find
I hope this question is not considered too basic for this forum, but we'll
I'm actually writing an MPI program. This is a basic client / server pattern.
This is a fairly basic question, which for some reason, a proper solution escapes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.