Dougal Campbell's geek ramblings

WordPress, web development, and world domination.

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.

About Dougal Campbell

Dougal is a web developer, and a "Developer Emeritus" for the WordPress platform. When he's not coding PHP, Perl, CSS, JavaScript, or whatnot, he spends time with his wife, three children, a dog, and a cat in their Atlanta area home.
This entry was posted in Blogs, Design, Plugins, WordPress and tagged , , , , , , . Bookmark the permalink.

52 Responses to Theme Preview Plugin

  1. Pingback: phil ringnalda dot com

  2. Matt says:

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

  3. Pingback: WordPress at Pierce College » Blog Archive » a few more plugins

  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. Pingback: im web gefunden » Wordpress - Hilfe bei der Arbeiten an Themen

  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. Pingback: GotChance - A Geek’s Blog » Blog Archive » Theme Demos Update

  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. Pingback: WordPress Plugin - Massor av bra WordPress plugins

  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. Pingback: A couple of fun and useful plugins | The Sucessful Part-Time Networker

  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. Pingback: YAB » Blog Archive » [Wordpress] Theme viewer plugin

  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. Pingback: Theme Preview_Wordpress plugin

  31. Pingback: Vebut.se Blog » Blog Archive » Showcase Vebut.se WP Themes

  32. Pingback: geek ramblings » WordPress 2.5 Beta

  33. Pingback: wordpress plugins | what i use | phoFuki

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

  35. Thank you for your amazing site.

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

  37. Calvin says:

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

  38. 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?

  39. shorty says:

    It does’nt work :(

  40. Uroda says:

    shorty on my site all work’s ok

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

  42. 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?

  43. bizuteria says:

    I have problem. It does'nt work

  44. Pingback: Ensight – Jeremy Wright » 11 Hawt WordPress Plugins I’ve Fallen In Love With

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

  46. Pingback: 20 de pluginuri Wordpress recomandate - prima parte | WorldIT

  47. Pingback: Karrai

  48. 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 ?

  49. 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 ?

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

  51. Pingback: 11 Hawt WordPress Plugins I've Fallen In Love With

  52. Pingback: What makes me hit Subscribe | Heartdrops.org

Leave a Reply

%d bloggers like this: