custom post plugin sorting fixes