have_posts() wrong result in archive.php
-
hi,
i was programming my archive.php file for listing my custom post file,
and i was using the casual loopif (have_posts()) : while (have_posts()) : the_post(); my code here endwhile; endif;
i have make only 1 post before editing my archive file,
and the loop was showing nothing
in facthave_post()
was sendingfalse
and when i had addedelse: global $wp_query; echo '<pre>'; var_dump($wp_query); echo '</pre>'; echo $wp_query->post_count; endif;
i’ve seen that
$wp_query
was sending back for the post count 1 and the functionhave_post
was sending false,
has i have 1 post the post count was the right one, and when i have added a second post, they where showing correctly, so my question is does thehave_post()
in archive.php need too have 2 post or is it the custom field wichmake it bug?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘have_posts() wrong result in archive.php’ is closed to new replies.