Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid Goncalves
3,417 PointsPosts disappear when I use the wp_query
I have created a tag page template and when I use the standard Worpress loop the content displays correctly. But, I have to order the post and when I use the wp_query the content disappears and the tag page shows as empty. I have written the query correctly but can't understand why it is not working. Any ideas?
3 Answers
Cindy Lea
Courses Plus Student 6,497 PointsDid you use have_posts()
function or the_post()
with it?
Jonathan Grieve
Treehouse Moderator 91,253 PointsTry adding your variable to have_posts
in the if part of the function
like this
<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
Hope this helps.
Jacob Mishkin
23,118 PointsWhat do you have set up in your array for your var $args?
David Goncalves
3,417 PointsDavid Goncalves
3,417 PointsI used the function like this:
<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>