4

How can you create a live demo page for a theme ?

something like a wordpress theme showcase, allowing customers to preview a specific theme live before they decide to purchase.

I have seen this on studiopress for example or any major theme seller.

Example.com - main website

Example.com/theme1/ - displays a demo of a certain theme

example.com/theme2/ - another theme, ETC

Can this be done with a plugin? Or do you have a better idea perhaps multisite?

Thank you

  • Create a sub-domain ( demo.site.com ) and supposing you have theme 1, install WP at /theme1 ( demo.site.com/theme1 ) and go to themes and activate theme1.. just a thought, – Samuel Elh May 1 '15 at 16:03
  • Yes, but in order to be able to have theme2 , theme 3, theme x, I should have multisite enabled. Right? – ClawDuda May 1 '15 at 19:30
  • Yes, either multi-site or doing multiple WordPress installations. – Samuel Elh May 1 '15 at 19:51
  • What about something like: github.com/OriginalEXE/Switcheroo - I never tried though. – Mayeenul Islam May 3 '15 at 4:01
5

This is how I would do it in a plugin:

  1. Install WordPress as a multisite with subdomains.

  2. Use the main site for the theme shop, install Easy Digital Downloads or another shop plugin. Create a product for each theme, make sure the slug matches the theme directory name.

  3. Upload your themes.

  4. Write an empty function wp_install_defaults() to prevent the default content in new sites.

  5. Add the test data from wptest.io to your plugin. They are better than the WordPress theme test data.

  6. Hook into wpmu_new_blog and check if the site slug matches an existing theme. Then:

    • Install the test data.
    • Set the option blog_public to FALSE to prevent search engines from indexing your test data.
    • Create or update a site option with an array containing the site ID, the theme slug and the visible theme name that you get from the style.css.
    • Activate the matching theme.
    • Create a sticky post from the content of the style.css and add a Buy now! link that goes to the product on the main site with a matching slug.
  7. Force the admin bar to be visible on all sites, even when the user is not logged in. Add a menu that is fed from the site option and build a list of all theme preview sites. You can also use a widget for that.

  8. Filter the product page on the main site and add a link to the demo site with the information from the site option.

There are probably many details that I missed here, but as a basic concept, this should work fine.

| improve this answer | |
  • This seems good. I will accept it as an answer. Thanks for you help. – ClawDuda May 3 '15 at 16:42
  • Edit. I will still wait for answers that not require coding myself. Perhaps an already build plugin. Or another solution ofc – ClawDuda May 3 '15 at 16:47

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