How to retrieve the latest post only?
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(); ?>
<?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?
Oh just one more thing. Is there a wordpress API reference somewhere?
I don’t think you can do coding of that nature on a WordPress.com blog. Php isn’t supported as far as I know. You might want to try the Forum Search box for PHP.
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:
if you’re hosting your own wordpress blog, you need to ask in the other forums: http://wordpress.org/support
His blog appears to be a WordPress.com 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 WordPress.org 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 WordPress.com. 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 WordPress.org questions lately? Something must have changed, because I never saw so many before.
IMO we are getting approximately the same number of confused bloggers “looking for wordpress.org” 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 “wordpress.org” and I’ve been doing that.
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 wordpress.org had a forum.
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 wordpress.com and worpress.org and would have sent you over to http://wordpress.org/support ages ago http://wordpress.com/forums/topic.php?id=3700&replies=1
Bye, bye and happy blogging :) *lol*
The topic ‘How to retrieve the latest post only?’ is closed to new replies.