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 8658553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:47:45+00:00 2026-06-12T15:47:45+00:00

I need to make a WordPress template for a client where they define multiple

  • 0

I need to make a WordPress template for a client where they define multiple nested (2-level) pages and display them on a single page. The nested pages will be in tabbed sections so users can navigate between those sections by changing tabs. They would also like to have a couple of page displayed normally (on separate pages). To handle that I figured I could just use a different template for pages that go in one page or pages that are separate.

I figured out how to display the pages, but I don’t know how to get WordPress to generate the links I want. I want to use the built-in WordPress menus if possible to build the menu with links to anchors (like <a href="#section"> I can’t remember the terminology).

I wasn’t able to find any example of a single page layout in WordPress except for paid themes (and I’m not paying just to see how someone else did it). I was hoping to use the WordPress built-in menu if possible but if not I guess I could just build the menu myself.

Here is how I display the page:

<?php
/**
 * Template Name: One Page Template
 */

get_header(); ?>
    <div id="primary">
        <div id="content" role="main">

            <?php query_posts(array(
                'post_type' => 'page',
                'post_parent' => 0,
                'orderby' => 'menu_order',
                'order' => 'ASC'
                // would also like to check something like 'template' => 'one-page'
            )); ?>

            <?php while (have_posts()) : the_post(); ?>
                <article class="page" id="<?php echo $post->post_name; ?>">
                    <h1><?php the_title(); ?></h1>

                    <?php the_content(); ?>

                    <?php $sub_pages = new WP_Query(array(
                        'post_type' => 'page',
                        'post_parent' => $post->ID,
                        'orderby' => 'menu_order',
                        'order' => 'ASC'
                    ));
                    while ($sub_pages->have_posts()) : $sub_pages->the_post(); ?>
                        <h2><?php the_title(); ?></h2>

                        <?php the_content(); ?>
                    <?php endwhile;?>
                </article>
            <?php endwhile; // end of the loop. ?>

        </div><!-- #content -->
    </div><!-- #primary -->
<?php get_footer(); ?>
  • 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-06-12T15:47:46+00:00Added an answer on June 12, 2026 at 3:47 pm

    Here is what I figured out

    function one_page_permalink($permalink, $id)
    {
        $template = get_post_meta($id, '_wp_page_template', true);
        if ($template == 'one-page.php') {
            $post = get_page($id);
            return '/#' . $post->post_name;
        }
        return $permalink;
    }
    
    add_filter('_get_page_link', 'one_page_permalink', 10, 2);
    

    It’s not perfect but it does what I need.

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

Sidebar

Related Questions

I'm programming a wordpress theme and need to make it save data, how should
I am customizing wordpress blog and I have a need to make custom sidebar
I need to make a query in a WordPress plugin but I couldn't find
I need to make it easy for users to attach a single image to
I am making a menu on a Wordpress template and need the menu to
Hello I need to make a wordpress slideshow. I need the loop to list
I'm creating a Page Template for a WordPress site . In the file newpagetemplate.php
I'm working on a WordPress template and need to add a hyperlink to the
In order to make use of a particular jQuery menu in WordPress, I need
So here's the deal: I need to make all posted images in wordpress have

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.