Good day!
On a site I'm helping with they use some code to display the lastest 3 blog posts from a specific category.
The code used can be found here: http://pastebin.com/xCzrqzj3
The problem is that the post titles do not match the right posts. Everything is mashed up like this:
The title from post A –– is listed above post B
The title from post B –– is listed above post C
Etc.
I have already tried changing a few things, but i'm not a coding expert.
It would be greatly appreciated if anyone could point out what's going on!
A sample of a live page can be found here: http://bit.ly/Ljujdi (Dutch)
Thank you.
Nick
s_ha_dum
Member
Posted 1 year ago #
I believe you need to be running the_post(); just after line 17 in your pastebin code. Look at the main loop just above code that isn't working. You are actually running the_post() too late for it do some of what it needs to do.
Thanks for your reply!
Though I'm not quite sure if I totally get it. I tried to move the code up –– just like you said, I'm just not sure up til which line after the_post() should be moved up.
I posted my complete page here: http://pastebin.com/bPhU1N0p
If it's not too much to ask, would you please link up a pastbin with the code you would have me use?
Thanks again,
Nick
s_ha_dum
Member
Posted 1 year ago #
I'm just not sure up til which line after the_post() should be moved up.
In your new file move it up to just after line 38. You will end up with this:
<?php if (have_posts()) {
while (have_posts()) {
the_post();
?>
Bless you!
That seemed to completely fix it :-)
Thanks a ton!