I’ve commented out that first line: $mid = isset($mID) ? $mID : "1"; and it works beautifully!
Thanks for pointing me in the right direction!!
If you do mobile detection in a plugin you get around caching issues and can do cool things like switch to a mobile template or redirect to a different mobile site. I think it’s better than using a snippet.
James