Added 'function query( = FALSE) { ' to line 26. This replaced 'function query() {' and hopefully will solve the php error I am getting with contextual filters.