fixes WP issues on virtual-pages-with-templates

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