Sorry my pastebin url didn’t work in the last post! Try this…
http://pastebin.com/zWZYWF0R
Thanks –
I copied your code but got an error message:
Parse error: syntax error, unexpected T_VARIABLE in D:\xampp\htdocs\path_to_file\index.php on line 17
Any ideas why please?
Misplaced single quote. Try http://pastebin.com/5xmkTXSc
Ah. Thanks. The post per page now works exactly as I wanted – however, every post is now being given the ‘first entry’ class.
Thanks for that Esmi! Its not quite right though – sorry – I should have explained more clearly. I wanted only the very latest post to be give the class ‘first entry’ then every other post should be class of ‘other-entries’. Using your code all the posts in the first page are given the class ‘first entry’ and then the post on subsequent pages are given the style ‘other-entires’, which is not quite right.
Also – the loop is missing out a post. I currently see the 5 latest posts on page 1 (post 1 – 5) and then on page 2 I see posts 7 – 12. This is missing out post 6 (?).
Thanks again…
I have amended Esmi’s code slightly (see pastebin link below) and now have the latest post given the ‘first entry’ class and every other post ‘other-entries’ class (as intended).
The only thing to now resolve is the missing post?! When on the first page of posts I see five posts (say posts number 1-5 – which is correct) however page 2 starts with post number 7 (so it seems to be skipping post number 6).
Any ideas why please…
http://pastebin.com/SMabySE9
I have the same “problem” but the other way around.
I have 9 post displaying on the first page, and 8 on the next ones. so on page 2, I see my last post of page 1. but it doesn’t happen on other pages.
Here’s the reason why, but haven’t figured out the way to fix it yet.
What’s happening is when you switch your posts_per_page parameter, WP recalculates its offset from that new parameter.
So let’s say in your case you have 5 on the first page and 6 on subsequent page.
It’s going to show you 1-5 on page 1, but then when you go on page two, and ask for 6 instead, WP will think you had 6 on the first page, hence why you’re getting 7-8-9-10-11-12 on your page 2
found this, http://pastebin.com/51r7PTwb
and it fixed my problem.