Use of WP_Query
-
This might have a very simple solution, but I’m really struggling. I’m looking to pull sub-pages and their properties: a thumbnail, the excerpt etc. — things that I can’t get from simply listing the pages.
I’ve used a WP_Query to call this information; and this works well. My issue is with subsequent page processing. Simple requests (like get_author() ) don’t seem to work correctly.
Key question: how can I return the processing to the original page, rather than processing my WP_Query?
My code is here for the thumbnails…
<!-- THUMBNAILS --> <?php $marberCurrentPage = $post->ID; $marberSubPages = new WP_Query(); $marberSubPages->query("post_status='publish'&post_type=page&orderby=menu_order&post_parent=" . $marberCurrentPage); while($marberSubPages->have_posts()) : $marberSubPages->the_post(); ?> <div class="sub-page span-12 last"> <div class="sub-page-thumb span-4"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php bloginfo('url'); ?><?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=162&w=220&zc=1" alt="<?php the_title(); ?>" width="220" height="162" /></a></div><!-- .sub-page-thumb --> <div class="sub-page-text span-8 last"><h4><?php the_title(); ?></h4><?php the_excerpt(); ?> </div><!-- .sub-page-text --> </div> <?php endwhile; ?> <?php rewind_posts(); ?> <!-- THUMBNAILS end -->
…and you can see the page itself here…
https://uktheme.co.uk/wp263/phasellus/
…you can see that the author appears twice on the page (on the right sidebar as ‘admin’; and under the body as ‘Tester’). Tester is correct (and appears before the WP_Query above), admin is incorrect.
- The topic ‘Use of WP_Query’ is closed to new replies.