I have the code already working on my actual site and it’s implemented in Wordpress.
So the code I pasted went something wrong when I was fiddling around.
But I think I can fix it later.
Main problem is that the original tutorial doesn’t work properly.