« Previous

How to Create a WordPress Theme Viewer

Posted on February 21, 2008
Filed Under WordPress | 21 Comments
Tags: , , ,

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:

<li>Themes:
      <?php wp_theme_switcher(); ?>;
</li>

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

index.php?wptheme=THEME_NAME

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:

<a href="/?wptheme=THEME_NAME">Test Run</a>
or
<a href="/index.php?wptheme=THEME_NAME">Test Run</a>

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.

Go to Top

More interesting posts ...

  • No Related Post
Comments
21 Comments so far
  1. Fernando April 15, 2008 10:06 pm

    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 September 2, 2008 6:16 am

    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.)

  3. Sean "caleta de fuste" Redfearn November 2, 2008 4:58 am

    Thanks for the info its really helpful.

  4. Eric Carter November 2, 2008 12:46 pm

    Thanks Def helped out a lot.

  5. webhosting-dir November 6, 2008 5:38 pm

    thanks, giving it a try and will let you know how it worked out

  6. fredydeath November 10, 2008 11:22 pm

    Thanks for this - great idea.

  7. para50mg November 15, 2008 12:43 pm

    Nice post man i just signed up to flickr to!

  8. Daypexdyday November 17, 2008 7:23 pm

    i want to share my free wordpress theme here.

    Preview:
    http://www.elegantthemes.com/preview/eVid/

    Download:
    http://www.sendspace.com/file/6uv0n2

  9. House Cleaning November 28, 2008 1:39 pm

    Thanks, just what I needed, I will try it out.

  10. kokain76 December 9, 2008 3:21 am

    I really love to try it out. This is something new

  11. yongyuth December 11, 2008 1:40 pm

    Hmm. Good post.

  12. sanju December 11, 2008 5:47 pm

    Thanks for the great tips.

  13. AgusBagus January 30, 2009 5:57 pm

    Hello, thanks for your good tips. I am looking for similar plugin but able to auto preview/test run all themes that we installed. Any idea about this?
    Sample: http://wordpressthemesbase.com/
    What plugin are they using?

  14. Bali Megah Villas February 28, 2009 1:27 am

    nice article,Thanks for the great tips.
    keep sharing

  15. wahm March 6, 2009 8:04 am

    good information thanks!

  16. web designer mom March 6, 2009 8:06 am

    This is a great tip. I appreciate your time and effort to get the message out.

  17. Tony April 13, 2009 9:25 am

    Thanks for this - great idea.
    http://www.windowreplacementsite.com

  18. Alice Hall April 18, 2009 2:44 am

    Great information keep up the good work

  19. Craigslist Phone Verified Accounts June 13, 2009 4:57 am

    Nice one. I have stumbled and twittered this for my friends. Hope others find it as interesting as I did.

  20. Hosting June 16, 2009 6:04 am

    veryy nice

  21. hkwebhosting June 16, 2009 6:38 pm

    Great information keep up the good work

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

Attention
If you want to post source code, please wrap it with <pre> and </pre>

Categories

Polls

  • Which browser are you using to browser this site?

    View Results

    Loading ... Loading ...