[Resolved] have_posts() wrong result in archive.php
i was programming my archive.php file for listing my custom post file,
and i was using the casual loop
if (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
and when i had added
else: global $wp_query; echo '<pre>'; var_dump($wp_query); echo '</pre>'; echo $wp_query->post_count; endif;
i’ve seen that
$wp_querywas sending back for the post count 1 and the function
have_postwas 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 the
have_post()in archive.php need too have 2 post or is it the custom field wichmake it bug?
- The topic ‘[Resolved] have_posts() wrong result in archive.php’ is closed to new replies.