Need help? Check out our Support site, then

How to retrieve the latest post only?

  1. I'm fairly new to WordPress and was wondering how to control the function calls that retrieve posts:

    With the following code below (some code omitted for brevity):

    <?php if (have_posts()) : ?>
    <?php the_excerpt(); ?>

    and then

    <?php $currCount=0; ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php if ($currCount > 0 && $currCount <= 8) : ?>
    <?php the_excerpt(); ?>
    <?php $currCount++; ?>

    This will result in showing the first post, and then the next eight.

    I know this is not good coding (php is not my first language :)), but I just want to know if there's an easier way of doing this? Is there a particular function that handles the SQL calls easily?

  2. Oh just one more thing. Is there a wordpress API reference somewhere?

  3. I don't think you can do coding of that nature on a blog. Php isn't supported as far as I know. You might want to try the Forum Search box for PHP.

  4. Thanks for the reply...

    I think I may be posting in the wrong area? I just realized that wordpress."org" is probably a better source since wordpress."com" is more just for blogging and not coding.

    I found a link that is useful though, if others are interested:

  5. if you're hosting your own wordpress blog, you need to ask in the other forums:

  6. His blog appears to be a one, though. I think he may have registered the wrong kind of blog for what he wants.

    If you want to do coding, you've basically got to download the WordPress software from and host it yourself. If you want to use the shared blogging platform and not bother with coding, you can register a free blog at It's not that the two forums are for different aspects of one thing; they are two different kinds of software, two different kinds of blogging.

    OT but related: why are we getting so many questions lately? Something must have changed, because I never saw so many before.

  7. @raincoaster
    IMO we are getting approximately the same number of confused bloggers "looking for" altohough they don't know it as we did before. Maybe you think you're seeing an increase in them could be based on the fact that you working more frequently on the forum or maybe not [she shrugs]. drmike has asked that we tag each one of these with "" and I've been doing that.

  8. The reason I posted here is simply because I don't read the fine print often :), and just wanted to get something running as quickly as possible... hence I didn't take the time to realize had a forum.

  9. Hi
    I don't know whether to laugh or cry so I'm choosing laughter. You thought the pink sticky at the head of the forum titled "please read me first before posting" was "fine print". *lol* That thread actually clearly describes the differences between and and would have sent you over to ages ago
    Bye, bye and happy blogging :) *lol*

Topic Closed

This topic has been closed to new replies.

About this Topic