I have a page that displays posts (4 on each row), with a thumbnail image & title for each. Is it possible to click a text/icon link and dynamically switch the page template? I’m looking to provide an alternate view of the posts, perhaps with larger images, more text/custom fields added etc.
I thought it would be easy just to link to another page template but it changes the url (would like the url to stay the same) and for some reason it loads the closest matching post, rather than the new page template (I have the page template nested within the first).
Something like this
domain.com/page/?view=list
I think I have a workable solution on what I was trying to do. This works but is there a better way? Also are there any implications I should be aware of when using $_GET? Didn’t realize it would be this easy 🙂 perhaps I’m missing something.
Then if the URL is domain.com/page/?view=list I use an IF statement inside the loop to modify the markup as required:
It can be achieved with jquery slider or tabs, instead of page template where URL will change. Just need to work on the styling.
You can change the stylesheet of your current page with some Javascript.
In your
header.php
And in your template file :
Have you followed the Create a Multi-Layout Portfolio with WordPress tutorial and seen a working demo.