I’m designing a new template to replace an existing one. The template is called featured.php and I’m going to be replacing it with featured-new.php
I want to pass the variable “new” in the querystring, then if the new
variable is present it’ll using the featured-new.php file.
How can I do this? Is there a tag to tell a page to use a specified template?
I am assuming this is a Page Template, is that right? Meaning that it has a comment ‘Template Name: ‘ at the top, and its used when a Page comes up, and the name has been chosen from the ‘Page Template’ menu in the editor. If thats the case, then were on the same… page (pun was unavoidable.)
If thats the case, you need to filter ‘page_template’.
I don’t understand how you wanted to use ‘new’, sounded like to wanted a query string parameter that was called new, and see if it was just set at all. So thats what I did. If you meant something different you’ll need to change that bit of logic accordingly.
I would use
theme switcher
plugins such as this one, then customize whether present it only from URL or switch on the layout.Also, take a look at this: Theme Switching
I think that the easiest way to do this would be to if/else the current themplate to include new templete or not
in featured.php
You may also find more help in WordPress Template Hierarchy