Theme Preview Plugin

Early in the development of the “themes” support in WordPress, I bugged Ryan Boren for a “preview” feature. Instead, he wrote a Theme Switcher Plugin, which wasn’t what I wanted (but was still a cool thing to have). Now, he’s finally written a Theme Preview Plugin.

The thing is, I had already given up on him and written my own, weeks ago. I just never got around to documenting it and writing it up.

Differences:

  • Ryan’s has user-level checks (only level 8 or higher can preview), mine doesn’t
  • Mine does error checking to ensure that the theme actually exists
  • Mine allows you to separately specify which theme to pull the CSS from. This is because the themes themselves allow you to specify the style separately from the templates. This is actually somewhat redundant, but I tossed it in for experimentation, in case I wanted to override the stylesheet.

There, now you have a choice. And choice is always good. Ryan, feel free to add my plugin’s biological distinctiveness to your own 😉

Update 2007-07-26: Since the question keeps coming up — this plugin is compatible with any version of WordPress higher than or equal to version 1.5. This includes versions 2.0, 2.1, and 2.2, and it should continue to be compatible with future versions. It’s only about a dozen lines of actual code, it uses standard WordPress API calls (one function and two filters), and it doesn’t interact with the database. It’s vegan-safe, has a low carbon footprint, and uses recycled bits for maximum ecological friendliness. See the comments for examples of using the plugin here on this site.

Tags: , , , , , ,

52 Responses to “Theme Preview Plugin”

  1. WordPress Theme preview plugin . WordPress Preview theme plugin. Hmm. Active, aren’t they?

  2. Matt says:

    Wow, what a perfect candidate for collaboration on the WP-Plugins site! Come on guys. :-p

  3. […] ed by the variety of WP plugins. there’s just a ton of useful stuff out there. Theme Preview Plugin (might be useful in this environment once there are […]

  4. RUDE says:

    How can I activate this plug-in in my instalation of WordPress??

  5. Steve says:

    You should show an example of your plugin on your page so we can see preview in action.

  6. Dougal says:

    Simple enough.

    View this post with the Default theme.

    View this post with the Classic theme.

    View my main page with using my wife‘s Digital Divas theme.

    View this post with the Classic theme, but with my rockem-sockem CSS. Note that the sidebar changes, because the full rockem-sockem templates have a customized sidebar with extra goodies not present in the classic theme.

  7. […] Das erste heißt Theme Preview PlugIn und kommt von Dougal Campbell. […]

  8. essus says:

    Cannot modify header information – headers already sent by (output started at… ?!!

  9. essus says:

    but after all it’S ok

  10. Dougal says:

    WordPress 2.1 compatible.

  11. […] Today, i noticed that there was a small problem with the theme demo links. It was working only for users who have registered at the demo site. So, i removed that plugin and installed this one. […]

  12. Kakushin says:

    Hello

    I thinks it’s no compatible with WordPress 2.2 , isn’t it ??

    in the future ?

    thanks for the works

  13. Dougal says:

    Yes, it’s compatible with WordPress 2.2, as well. It should continue to be compatible unless some major change is made to the underlying theme API. Try the links in my earlier comment, above.

  14. Kakushin says:

    hum ok but when i upload the plugin on my website, wordpress don’t detect the plugin.

    and if i try to install the plugin with the installer plugin of wordpress, installer say’s : Invalide plugin package

    Do you kow the solution ??

  15. Is it WordPress 2.2 compatible? I don’t want to lost mysql data.

  16. Motoryzacja says:

    wow I’m impress. There is a lot of changes between classic/default them than your wife theme. I’ve a question about wordpress because I want to start with new release and I want to make some changes in the code and designe.. what about servers without modrewrite module ? Is there a simple method to turn it off like variable in cfg file ? I know that is off topic but I’ll be glad if someone can answer me.
    thx
    Lukas

  17. Jacek says:

    @Tomasz Gorski
    I was check on my blog and it’s compatible with WordPress 2.2
    And i must say it’s very usefull plugins 🙂

    thx a lot Dougal

  18. […] Theme Preview Plugin Har du gjort ett nytt WordPress tema som du vill testa innan du visar det för dina besökare? Om sÃ¥ fallet är, dÃ¥ är detta pluginet för dig. […]

  19. Excellent work Dougal, i allways enjoy your great stuff and love to read your blog. thank you so much for all your afford.

  20. James says:

    Doesn’t appear to be working in 2.3…

  21. Dougal says:

    Doesn’t appear to be working in 2.3…

    It’s working here, on 2.3.1 (and it worked in the original 2.3 before the update, too)… Try clicking the links in my comment above. I’ll grant you, this isn’t the most user-friendly plugin, since you have to manually tack on your own querystring. Try previewing the ‘classic’ or ‘default’ themes on your site, does that work?

    e.g.: http://www.example.com/blog/?preview_theme=classic

    I promise that *one day* I’ll release a new version of the plugin. Planned features for the future version:

    • Admin screen to set options
    • Option for setting a session cookie so that the preview is persistent
    • List the installed themes and let you choose which one to preview
  22. […] Theme Preview – Allows you to see what a different theme will look like on your site, without having to actually activate it. Here are a couple of examples for my site: […]

  23. Ambit says:

    It will be great, when you can add a Link in Admin-Screen > Themes to Preview the Theme directly

  24. hosting says:

    great news. But I have problem with this plugin 🙁

  25. Maya says:

    “I promise that *one day* I’ll release a new version of the plugin.” i hope the day will come in nearest future, it sounds interesting with the new planned features. please keep us up2date.

  26. Hafiz says:

    Thank you so much for this very useful plugin… just used it to provide a live preview for a theme I just released. Saved me from the hassle of creating a separate install for previews. Thanks again 🙂

  27. I just applied Theme Preview to an old blog of mine which is running on WP 1.5 – i’m to lazy to update WP version. I confirm – everything works fine. Excellent work, Dougal!

  28. […] to Dougal Campbell for the original Preview Theme plugin. Posted by Alexandre Girard Filed in plugin, preview, theme, […]

  29. Hi Douglas,

    Thanks for your plugin, i’ve made some modification to it, you can check the top-left corner on http://lasindias.info

    If you want to download it, or more information, go to check http://blog.alexgirard.com/2008/01/18/wordpress-theme-viewer-plugin/

    Cheers,

    Alex

  30. […] A little showcase of my work, nothing much. Actually a test of my new plugin = theme viewer by Dougal. […]

  31. […] (HeadMeta, Text Filter Suite, and Easy Gravatars), work just fine. The one that doesn’t work is Theme Preview. When I can find time, I’ll try to figure out […]

  32. […] Preview Theme:  Allows themes to be previewed without activation By Dougal Campbell. […]

  33. UNO says:

    It’s not working with me. I don’t know what is missing. Procedures I did.

    – Uploaded the plugin on my plugin folder
    – Activated the plugin on admin
    – Test the URL with special parameters
    – Failed!

    Query sample:

    /index.php?preview_theme=default&preview_css=beach-cars

    Can anyone please help me on this plugin. Thanks.

  34. Thank you for your amazing site.

  35. prezent says:

    Searching through websites I came across this article. I think it is fairly interesting considering the spam crusing about the net. Good Job.

  36. Calvin says:

    I’m now start my wordpress blog, i did really want to get more information about the theme

  37. Rufas says:

    Hi dougal,

    Your plugin is just what I needed, and it works fine with wordpress 2.5.1. 🙂

    One problem though, that your plugin is conflicting with “Permalink Validator” (to redirect non-existing page to 301/404 page) and will not work once I turn it on.

    Any suggestions?

  38. shorty says:

    It does’nt work 🙁

  39. Uroda says:

    shorty on my site all work’s ok

  40. Goran Web says:

    Do you offer the services of setting up Word Press for other companies, your knowledge is vast and you know all the tips and tricks. Im a novice and your blog is awesome, would like some lessons or help setting up one your way. Was going to go to UBD but you seem to be jacked.

  41. Charlie says:

    Why does the link to this widget just show code and the widget is misnamed? And why do all the links on this page lead to page errors?

    Lastly, why don’t we get an answer to the questions we ask about how to install this kind of widget?

  42. bizuteria says:

    I have problem. It does'nt work

  43. […] Preview Theme: If you’re ever wanting to edit one theme while having another viewable to the public, this is perfect. Not a huge innovation, as there are other ways to do this, but for idjuts like me it’s just dead simplestest! […]

  44. Anna says:

    I’m not having any luck with this plugin on WP 2.9. Am I not following some hidden instructions or does it just not work with this version?

    Thanks for any tips 🙂

  45. […] ce va micsora stresul “perfectiunii” in cazul developerilor web, este pluginul Preview Theme.Acesta ne va permite sa vizualizam preview-ul unei teme fara a fi necesara activarea ei, ci doar […]

  46. Karrai says:

    […] Theme Preview This plugin allows you to preview a theme without activating it. All you have to do is add ?preview_theme= onto the end of your URL. This is great for when you are working on a new theme and even for linking your visitors to a preview of a theme that you wish to offer on your site. […]

  47. Alex says:

    I activated the plugin with no problem. I followed the instructions and even mirrored the examples, but I still cannot get it to show a ‘preview’. It just directs the visitors to the main page. Is the format not domain.com/?preview_theme=theme-name ?

  48. e?itim seti says:

    I activated the plugin with no problem. I followed the instructions and even mirrored the examples, but I still cannot get it to show a ‘preview’. It just directs the visitors to the main page. Is the format not domain.com/?preview_theme=theme-name ?

  49. Is there a new version or an update of this plugin? It would be nice if there is gonna be a strong and working theme preview plugin

  50. […] Preview Theme: If you’re ever wanting to edit one theme while having another viewable to the public, this is perfect. Not a huge innovation, as there are other ways to do this, but for idjuts like me it’s just dead simplestest! […]

  51. […] know some of my favourite plugins but I’d like to suggest a couple to those in my class. Preview Theme by Dougall Campbell is a great one if you’re designing and developing your own themes. You […]

Leave a Reply for Maya