On this day…

In an episode of Clevercast Jonathan LaCour discusses freeing himself from Facebook by moving all his content from the network, as well as Instagram, to his own website. No small undertaking.

He mentions missing some features from Facebook such as the way it surfaces memories - inserting posts from the past into your feed. So, as part of the process he created an "On this day" page which lists all of his content, regardless of type or source, for the current day over the years.

It inspired me to do something similar but adding it to /Today rather than as a separate page. I looked to see if there was already a WordPress plugin to add this but, surprisingly, couldn't find one. So I set about writing my own solution.

How does it work?

To start I get the year of the first post to use as a base and assign this to a variable $count for use later. This is achieved with a post query then looking at the post_date of the oldest post. I could have just manually set this as 2008 but wanted to do it properly in case I reuse the code.

Then, for each year between then and last year (inclusive) run a custom query to get posts for the day of the year. The query is contained within a while loop while ($count < $today["year"]) and $count is incremented to stop at the right point.

The first time a post is found it displays the "On this day..." toggle but if no posts are found for the day in any year then nothing will be shown at all.

The toggle itself is a simple CSS trick using a hidden checkbox which, when checked by tapping on its label, shows the post links by use of the :checked pseudo-class:

#otdCheckbox:checked ~ .otdbody {

At the end, if $count == $today["year"] I close out the divs and it's ready. Just 37 lines of code (including whitespace) and a little CSS.

  1. hutaffe says: #
    @colinwalker I love this feature on Facebook. I‘m also working on this for my personal journal. One step further to get off of FB for me. It‘s great to see what was on my mind a couple of years ago during the same time.
  2. cleverdevil says: #
    @colinwalker @hutaffe it’s one of my favorite features of my website. I also have my website push the “On this Day” memories to my IndieWeb Reader so I don’t have to remember to visit the page.
  3. cleverdevil says: #
    @kulturnation I haven’t seen anything out there like that. However, I’d say that gives you a false sense of privacy. I would wager that nothing you “delete” from Facebook is ever truly deleted. This is why I am completely off now.
  4. kulturnation says: #
    @cleverdevil Delete is not for privacy reasons but just for taking away content from my timeline so that it becomes less interesting for other people. I can not delete it completely because FB is part of my job; I usually do not post original content there, just links to my blog posts, or sharing.
  5. hutaffe says: #
    @kulturnation @cleverdevil all the plugins that „work“ and I know of are in Chrome and basically just stupid robots which need luck to complete. I used the „On this day“ feature over the last year to turn every post to private. Deleting does not help with FB…