modified plugin to use post and postmeta rather than custom db table