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
Related Q & A:
- How do I compare two tables with the same column definitions in different schemas?Best solution by Database Administrators
- In Visual Studio 2012 or 2013, how can I register a DLL file on Windows 7 64-bit computer using a Custom Action command?Best solution by Stack Overflow
- How can I separate a video into two parts?Best solution by Yahoo! Answers
- How can I get into my Yahoo mail that I haven't used for a while?Best solution by Yahoo! Answers
- How can I compare camcorders easily?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.