Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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. 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; ?>
share|improve this question
    
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. –  songdogtech Apr 3 '11 at 18:39
add comment

3 Answers

up vote 1 down vote accepted

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

share|improve this answer
add comment

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

share|improve this answer
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
add comment

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(); ?>
share|improve this answer
    
Glancing at the comments on the original question, the OP apparently got it to work. –  Pat J 5 hours ago
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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