I am trying to make a loop to loop all pages beneath each order. I want this because I want to make a one-pager with a page as an element of the one-pager. So that you can go into WP to edit a page and choose a template, and it will be printed through a loop.
It was going well until I thought of something.
I have a loop, but it displays the title and the content, so not the whole page. I want several pages with different page templates. So you can go in the dashboard, select the template and it will be printed differently (and also different custom fields are added each template).
My loop is this:
$args = array( 'post_type' => 'page', 'order' => 'ASC' ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="section" id="<?php echo $post->post_name; ?>" style="background-image: url('<?php the_field('backgroundimg_home'); ?>'); background-color: <?php the_field('achtergrondkleur'); ?>"> <h1><?php the_title(); ?> </h1> <?php the_content(); ?> </div> <?php endwhile; ?>
So i want to print each page beneath each other, I have no idea how.. Isn't there just something like get_the_page..?
I studied the WordPress codex but couldn't find anything.