moved php stuff from theme index file into JS code