single page site with subpages

i want to make a single page site which has subpages with following structure

about us
team
-member1
-member2
contact

Read More

and i want the output to be like

<div class="about-us">
team content
</div>
<div class="team">
team content
    <div class="subpages">
         <div class="member1">
         member1 content
         </div>
         <div class="member12">
         member2 content
         </div>
    </div>
</div>
<div class="contact">
team content
</div>

and this is my loop so far

<?php query_posts(array('post_type'=>page, 'orderby'=>menu_order, 'post_parent' => $thePostID)); ?>

        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

             <?php if ( 0 == $post->post_parent ) { ?>
             <h1><?php the_title(); ?></h1>
             <?php } else { ?>
                 <h3><?php the_title(); ?></h3>
             <?php } ?>
             <h3><?php the_title(); ?></h3>
             <?php the_content(); ?>
        <?php endwhile; endif; ?>

thanks for helping, helmut

Related posts

Leave a Reply

2 comments

  1. To me it’s very simple, but a bit static.
    You can make a new front-page.php with the structure you mentioned. Then first make some pages (i.e.: About us, Members 1, Contact etc.) in your wp-admin. And use the get_page() function to call different page [using their individual ID] into different zone.

    Am I right?

  2. Now it is tested. I created PAGE (not POST) in admin panel and then used the page’s ID here in a front-page.php file (it will override the index.php, but won’t create any problem):

            <div class="about-us">
            <?php
           // VERY SIMPLE LOGIC
               $page_data = get_page(9); // page_id will be your Team page's ID (mine was 9)
               echo $page_data->post_content; // simply get the content of the page (without formatting)
            ?>
           </div> <!-- .about-us -->
    
           <div class="team">
                <?php
                // EXACT IMPLEMENTATION
                    $page_data = get_page( 6 ); // page_id will be your Team page's ID (mine was 6)
                    echo '<h3>'. $page_data->post_title .'</h3>';       // to echo the page title       
                    echo apply_filters('the_content', $page_data->post_content); // this filter will allow formatting from your page
                ?>
    
                <div class="subpages">
                    <div class="member1">
                        <?php
                        // JUST SEE WHAT YOU GOT
                            $page_data = get_page( 7 ); // page_id will be your Team page's ID (mine was 7)
                            var_dump( $page_data ); // var_dump will show you all the things what get_page() has brought to you.
                        ?>
                    </div> <!-- .member1 -->
                    <div class="member2">
                        Member2 content
                    </div> <!-- .member2 -->
                </div> <!-- .subpages -->
    
           </div> <!-- .team -->
    
           <div class="contact">
                Contact page content
           </div> <!-- .contact -->
    

    I commented inline. The whole thing is tested as per the code given in Codex. I’ve already shared that with you. with var_dump() see what it takes for you and improvise it whatever you like. (Thanks to Asadul Islam Sohag for assisting me)

    Yap! Code is Poetry!