Conditional template tag and sub pages extraction
-
Hello world and sorry for my bad and poor english.
I am trying to makea query in a template, to extract all the sub pages of the current one. In addition to this, the extracted pages must have a particulare template.
So, i have a page with (for example) 10 sub pages. 8 with a template A and the others with template B.
I am trying to extract only the sub pages with template B.This is my code. But the “is_page_template()” conditional tag don’t work in this query. Seems to work only inside the main loop. What can i do?
<?php $this_page_ID = get_the_ID(); query_posts('post_type=page&post_parent='.$this_page_ID); if (have_posts()) : while (have_posts()) : the_post(); if(is_page_template( 'templateB.php' ) ): the_title(); endif; endwhile; endif; wp_reset_query(); ?>
Thanks a lot!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Conditional template tag and sub pages extraction’ is closed to new replies.