fixes WP issues on virtual-pages-with-templates

includes #5, #6, #7, #9, #10, #11, #18 and #21 issues