0

This should be easy. I need to query to display one page in a tab. Just pull one page by one query, but I'm doing something (maybe lots) wrong here:

Edit: Hah. I forgot the_content It works now.

<?php

$the_query = new WP_Query; $the_query->query ('pagename=about' );

while ($the_query->have_posts()) : $the_query->the_post(); ?>

<?php the_content(); ?>  //forgot this

<?php endwhile; ?>
  • Query works fine for me, try chucking in a wp_reset_query() before (and possibly after) your custom query and see if that helps.. – t31os Apr 3 '11 at 17:50
  • Thanks. That's a good point. But. Arggg... I forgot the_content. Works now. – markratledge Apr 3 '11 at 18:39
1

Hah. I forgot <?php the_content(); ?>

0

Shouldn't this be $the_query = new WP_Query('pagename=about'); ?

  • 1
    Nope, either method is valid.. – t31os Apr 3 '11 at 18:28
  • Ah ok - I didn't realise have_posts() also executed the query – anu Apr 3 '11 at 19:23
-1

If there is only one page to call, why use "while"? Look:

<?php $query = new WP_Query;
$query->query ('pagename=about');
$query->the_post();
the_content(); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.