I’m stumped. How on earth do we get this to work?

Is there any chance you could roll this into a plugin which actually works? I must be doing something stupid with the file as it looks like it SHOULD work, but all my attempts keep creating a plugin which never says it needs updated :(