• Resolved awfief

    (@awfief)


    Hi there,

    I’m using WordPress 1.5.1 at https://www.biresource.org, and as you can see from the link, only one post shows up. However, if you check out the side links, there are MANY headlines, in July, June, etc. Clicking on them works.

    I’m confounded as to why this is. I’ve checked the SQL (by using an echo statement and typing that into MySQL) and it’s correct, it gets 10 records. In fact, if you view source on biresource.org, you can see that the first HTML that’s there is:

    <!– 10 –>

    which is an echo of count($posts) that I put in. So even after the query runs, the # of posts is 10. The echo statement is the line before the foreach statement:

    <CODE>
    <div id=”content”>
    <?php echo “<!– ” . count($posts) . “–>”; ?>
    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    </CODE>

    It displays the first post perfectly, and then ends by exiting normally. The code at the end of the post is:

    <CODE><?php comments_template(); ?>
    <img src=”https://www.biresource.org/images/rainbow_line.gif&#8221; alt=”(rainbow line)
    ” vspace=4 hspace=20 height=4 width=100%>
    <?php echo “<!–“. count($posts) . “–>”; ?>
    <?php endforeach; else: ?>
    <?php _e(‘Sorry, no posts matched your criteria.’); ?>
    <?php endif; ?>
    </CODE>

    Note the echo of count($posts) again — if you view source on https://www.biresource.org, and search for “rainbow_line” you’ll see that <!– 1 –> is in the HTML source — that’s the count of $posts at the end.

    This is obviously the problem, that the query is correct and gets 10 posts, but somehow in the foreach loop, the $posts array loses the rest of the posts. . . $posts isn’t referred to in between, and I can’t think of what I’d done or anything.

    Please help if you can. I’m happy to send files and code and such. Thank you in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter awfief

    (@awfief)

    Aha!

    I found the problem — I was using viewlevel as a plugin, and I’d made at least 9 protected posts. So it was retrieving all the posts, they just were protected.

Viewing 1 replies (of 1 total)
  • The topic ‘Only one post shows’ is closed to new replies.