Hey @Alex,
If your version of that code is not working, then to troubleshoot we would have to be manually testing and debugging a customization. We unfortunately cannot help with that, as described in more detail in the “Product Support” section here → http://theeventscalendar.com/terms
That being said, I’m happy to at least try and help as much as possible here!
To that end, can you copy and paste your entire, un-edited custom code into a Gist at http://gist.github.com, and then share a link to that Gist here?
I cannot promise a successful outcome here, unfortunately, but like I said, I’m happy to give it a shot and see if I can spot the problem.
Thank you,
George