Get a Page Template outstide the loop
-
Hello everyone.
I have an homepage with javascript slide-tabs that contains for each tab subpages from a certain parent page. All works very well with get_posts but when one of these subpages has a template it isn’t displayed.
This is my code to call the subpages of a parent page:<?php $args = array( 'post_type' => 'page', 'numberposts' => -1, 'post_status' => null, 'post_parent' => '934', 'order' => ASC, 'orderby' => date ); $subpages = get_posts($args); foreach($subpages as $post) : setup_postdata($post); ?> <div class="tabs-content"> <?php the_content(); ?> </div> <?php endforeach; ?>
In this way i get the correct content from a page but obviously not his page template.
I tried to use:<?php if (is_page_template( 'template-name.php' )) : ?>
I can’t figure out. Please someone knows a solution?
Thank you.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Get a Page Template outstide the loop’ is closed to new replies.