Dropping duplicates from an array
-
All right, at my wits end. Been working on this particular issue for sometime and I can break through it so would truly like some help.
I have an ‘archive’ of post listings that looks for the date of a post and then prints that date, one right after another. What I want it to do is if it’s the first instance of a particular date (in this case I’m only using the year) it should print it, if it’s a separate instance it should be ignored.
For example the list is built through the_date as such: 1345, 1356, 1356, 1566, 1765, 1765, 1934
What it prints out is: 1345, 1356, , 1566, 1765, ,1934.
Here is the page: https://theendlesswhispers.com/category/mythos/.
If you see the big ‘watermark’ behind the posts that show the date you can see the years are repeated. I want each date to only show up once.
I’ve been playing around with if statements constantly and I’ve got an idea how to do that I just can’t figure out how to get the duplicate dates dropped.
Thanks.
- The topic ‘Dropping duplicates from an array’ is closed to new replies.