How to Create a WordPress Theme Viewer

For WordPress veteran this might not be new, which is, let visitor preview multiple themes in one WordPress installation. It puzzled me quite a while before I figured out how to do it. The very reason for the need of this feature is that I want to allow regular users to view different themes on a WordPress powered website. I wasn't able to until I ran into this page. Yea right! A theme switcher. I installed this plugin and tested. It provides the exact function that I need. Fantastic.

Now here comes the interesting stuff. The official documentation documented the plugin is as follow, which outputs a list of links that can switch to a specific theme:

If you view HTML source of those links, you'll find something similar to this:

This is very useful because now I can build a WordPress theme viewer by this plugin alone. Let's say you have a number of WordPress themes installed and you want to show a demonstration of each to your visitors with a text link Test Run. You can easily accomplish this by appending the name of the theme to the wptheme parameter:

The question now is how to find out the name of the theme. Easy enough, just log into Admin area and go to Presentation tab, where you can see a detail list of themes including their names. Even easier, under each theme folder, you can find a file called style.css, in which you can find theme name of the theme there.

You've just created a WordPress theme viewer.

8 Comments How to Create a WordPress Theme Viewer

  1. Fernando

    Hi, thank you so much for this post. This really help me a lot. I wanna know how create a Test Run for lont time. I put the information in my site, and a link to your post. Thank you again. :)

  2. Mrs. Micah

    And don't forget to add a link BACK to the original theme. I used a theme switcher plugin and then annoyingly forgot to link back to the main theme. Fortunately, I fixed it.

    (As for the question asked by the spam commenters, it's a legitimate one and the answer is to install WordPress on your computer itself.)

Comments are closed.