Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

luchiabloomfield on "Displaying all pages in one page (including their own templates)"

$
0
0

Hi,

I've spent a couple of hours searching for this answer, so I apologise if it's already been asked and answered before.

I've got a page template that calls all the pages in the menu order, which works fine. The only problem is none of the individual page templates are showing.

This is my existing code:

<?php get_header(); ?>

<?php
	/*
		Template Name: Main Page Template
*/?>

<?php query_posts( array('post_type'=>'page', 'posts_per_page' => 1000, 'orderby' => 'menu_order', 'order' => 'ASC') ); ?>
<?php if(have_posts()): while(have_posts()): the_post(); ?>

    <?php
        global $post;
        $slug = $post->post_name;
        locate_template(
            array(
                "template-$slug.php",
                'home_page.php',
                'thepies_page.php',
                'theteam_page.php',
                'thegirls_page.php',
                'stockists_page.php',
                'index.php',
                'contact_page.php'
            ), true
        );
    ?>
<?php endwhile; endif; ?>

Hopefully someone can help me, thank you.


Viewing all articles
Browse latest Browse all 8245

Trending Articles