WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For a project of mine I need to define an alternative template for single posts. To be more specific I need each post to be displayed as usual when the website is browsed but I need to create different single pages reachable from different URL to create a sort of a mini-website for each post.

(I'm actually using the WooCommerce plugin and what I need to do is to create a mini-website for each product. This needs to be something "outside" from the main website, with a complete different graphic template and is going to be reachable through a QR-code).

Hope it makes a bit of sense. Thanks for your advices and/or suggestions. Angelo

share|improve this question

You could set a url parameter to change the display so that the URL could be the same, then have your QR code do a pass-through to the desired page. Without knowing how the QR codes are setup and such, I can't offer much more on high-level implementation than that. The way to switch the templates would be as follows:

if( get_query_var( 'from_qr' ) == true )
    get_template_part( 'qr', 'single' );
    get_template_part( 'loop', 'single' );

You may want to use $_GET instead of get_query_var(), and you can structure that differently (I like get_template_part() because it makes the code easier to read and enhances my focus on SoC), but that's the general idea.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.