How can I display older custom post outside the loop in Wordpress?

How can I compare the values of two functions from two separate posts in a WordPress loop?

  • On my loop page, I need to compare dates of posts so that only unique dates display.  So, when someone scrolls through the posts, the date will update in one position depending on the date of the posts visible.  Ideally, the date will hang off the left of a post and scroll up with the posts and displace the previous date, but a unique date will only display once until the posts change date. So, while(the_time('top visible post') == the_time('any other visible post')) { don't display the div with the_time() of anything but the top post. Or something like that, I guess.  And then I guess I could figure out the jQuery sliding crap latter.  Just to get that date to change is priority 1. }

  • Answer:

    The easiest way is to put the results into variables and compare them. I know my answer is too short, but it's what I think is the simplest. Edit: I missed the "two separate posts" part of this question. You could add a variable in jQuery to each post being displayed (or array) that compares with the unique date variable as you scroll. I suppose you could by yourself do some digging on how to play with the "sliding crap" as you describe it using mousewheel, scroll or whatnot :-) (Addendum: I have to agree with Ivan's comment; the SO community would have been more helpful. Besides, someone else might have the same problem as you do, so archive-wise this would better belong to SO.)

Lorna Timbah at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.