- This topic is empty.
-
AuthorPosts
-
January 10, 2010 at 4:32 pm #27524
silvers
Memberhi!
i have been trying to do something similar to css-tricks in showing my newest post in a different way to the other posts on the page. that seems all good, however when you click on "older posts" it has a problem as it still shows the newest post on each page, and doesn’t work in the same way css-tricks does.
could someone help me on this one please? i would really appreciate it.
this is the site i have the problem on (i know its crap but i am trying!) http://www.mariosuniverse.com/blog
here is my code… (thanks in advanced)
do i need a conditional statement to only do it on the home page like <?php if (is_home()) { } ?> ??? if so can someone show me the way? cheers
Code:have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;?>ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
” rel=”bookmark” title=”Permanent Link to “>
Not Found
Sorry, but you are looking for something that isn’t here.
January 11, 2010 at 7:04 am #69241silvers
MemberHiya,
Just wanted to bump this again. (I won’t keep doing it and piss everyone off).
I have searched for ages for a fix on this but have still not found the info i am looking for, can anyone help?
Thanks.
January 11, 2010 at 12:21 pm #69248TheDoc
MemberIt is a fine question, and I feel like I know the answer, but it isn’t coming to me at the moment.
I’ll ponder it some more, but hopefully Chris catches this one first!
January 11, 2010 at 1:14 pm #69251silvers
Memberthanks! any help would be gratefully recieved!!
January 13, 2010 at 7:20 am #69350silvers
Memberok so i have been on a wordpress forum and got this info…
<?php
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
if ($paged < 2) {
// DO STUFF
}
?>The guy basically said that this would say that this would check if it was page 1, and do stuff accordingly. I had a quick go and couldn’t work out how to use it with 2 loops because my knowledge is pretty lacking!
what do you think Doc? or anyone else that fancies being my hero!?!!?
Thank you!
January 13, 2010 at 12:37 pm #69357Chris Coyier
KeymasterYeah you gotta check if you are on a paginated page for that first query. Otherwise that first query has no idea and will just grab the most recent post. You don’t need to do that fancy stuff to know if a post is paginated though, you can just:
Code:if ($paged) {
// do stuff
}The $paged variable is equal to the # of page you are on. So if you are at /page/2, $paged will be 2. You can use that number to offset the query. Like
Code:if ($paged) {
query_posts(“posts_per_page=1&offset=$paged”)
}That offset parameter will skip the first X posts. You’ll need to adjust as needed. As in, if you show 5 posts per page, you’ll need to offset by 6 on page two, so you’ll need to do like:
Code:$offset = (5 * $paged) + 1;All covered in Digging Into WordPress — wink wink.
June 17, 2010 at 3:17 am #78101John Tanedo
Membergot similar issue on my blog … http://makeyourtheme.com/blog it just doesn’t work here is my codes
Code:hope someone can help. . . i got the dig-wp book btw but dont know which chapter to get around this problem is it page 95?
June 29, 2010 at 12:23 am #79029hoss9009
MemberHere’s my code…
I have the first post looking different ONLY on the first page… I use pagenavi for pagination.Code:
Not Found
Sorry, but you are looking for something that isn’t here.
Not Found
Sorry, but you are looking for something that isn’t here.
October 10, 2011 at 8:40 pm #88843Ebony_McLaughlin
MemberI need some help with this too…links keep reverting back to the new entries and not the older ones.
I’ve been adding the suggested code above from Chris into my bloghome.php file but its not happening for me.
blog page is http://vigourdynamicfitness.com.au/blog/….can anyone lend a hand =DAuthorPostsViewing 9 posts - 1 through 9 (of 9 total)- The forum ‘Back End’ is closed to new topics and replies.