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.

Stumble It!
Theme Preview Plugin

Related posts:

  1. Text Filter Suite Plugin for WordPress
    "Since Talk Like a Pirate Day is only three weeks away, I spent some time this weekend revamping my old Fun Filters hack. The result..."
  2. My first WordPress plugin: HeadMeta
    " Mark Pilgrim was in the #wordpress IRC channel earlier, asking if there was some way to add <link> and <meta> tags to the <head>..."
  3. Plugin preview: FancyBox Gallery
    " I don’t have it ready for release yet, but I’m working on a new WordPress plugin which will integrate the FancyBox jQuery plugin with..."
  4. Plugin: SpamForceField
    " SpamForceField is my newest anti-spam plugin for WordPress. This one does a couple of interesting things: All connections via pinappleproxy are denied. Every connection’s..."
  5. New theme, same as the old theme
    " I’ve done some minor maintenance around here. Can you spot the differences? Probably not. What I’ve done is upgraded my old Sandbox 0.6.1 theme..."
This entry was posted in Blogs, Design, Plugins, WordPress and tagged , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

37 Comments

  1. Matt photomatt.net
    Posted March 9, 2005 at 2:29 pm | Permalink

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

  2. RUDE rudeworks.com
    Posted March 10, 2005 at 4:35 am | Permalink

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

  3. Steve cafe789.com
    Posted March 15, 2005 at 9:42 pm | Permalink

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

  4. Dougal dougal.gunters.org
    Posted March 16, 2005 at 2:35 pm | Permalink

    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.

  5. Posted January 4, 2007 at 4:24 pm | Permalink

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

  6. Posted January 4, 2007 at 4:32 pm | Permalink

    but after all it’S ok

  7. Dougal dougal.gunters.org
    Posted February 5, 2007 at 12:33 pm | Permalink

    WordPress 2.1 compatible.

  8. Kakushin kakushin.fr
    Posted July 10, 2007 at 4:30 am | Permalink

    Hello

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

    in the future ?

    thanks for the works

  9. Dougal dougal.gunters.org
    Posted July 10, 2007 at 10:06 am | Permalink

    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.

  10. Kakushin kakushin.fr
    Posted July 11, 2007 at 2:23 am | Permalink

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

  11. Tomasz Gorski profesjonalna-reklama.pl
    Posted July 25, 2007 at 11:23 am | Permalink

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

  12. Motoryzacja fuksik.pl
    Posted July 27, 2007 at 6:43 pm | Permalink

    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

  13. Jacek clannews.pl
    Posted September 11, 2007 at 6:02 am | Permalink

    @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

  14. Michael Biner lb-bueromoebel.de
    Posted November 7, 2007 at 11:34 am | Permalink

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

  15. James shorttermmemoryloss.com
    Posted November 9, 2007 at 10:44 am | Permalink

    Doesn’t appear to be working in 2.3…

  16. Dougal dougal.gunters.org
    Posted November 9, 2007 at 11:14 am | Permalink

    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
  17. Posted November 18, 2007 at 1:43 pm | Permalink

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

  18. hosting az.pl
    Posted November 22, 2007 at 5:49 am | Permalink

    great news. But I have problem with this plugin :(

  19. Maya a-p-c.de
    Posted November 24, 2007 at 3:27 am | Permalink

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

  20. Hafiz playworkplay.com
    Posted December 17, 2007 at 11:40 am | Permalink

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

  21. Yury, logo designer logodiver.com
    Posted January 6, 2008 at 4:12 pm | Permalink

    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!

  22. Alexandre Girard blog.alexgirard.com
    Posted January 18, 2008 at 3:08 pm | Permalink

    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

  23. shemetov shemetov.ru
    Posted February 12, 2008 at 9:52 am | Permalink

    Адвокат оказывает юридические услуги, юридическая консультация, юридическая
    помощь, юридическая консультация по вопросам таможенного оформления, экспорт,
    импорт, таможенный адвокат, адвокат по контрабанде,
    адвокат по таможенным вопросам, юридическая консультация,
    таможенный адвокат, таможенная консультация, уголовный адвокат, адвокат по должностным преступлениям

  24. UNO
    Posted March 20, 2008 at 4:56 pm | Permalink

    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.

  25. Gry dla Dzieci prizee.evinator.pl
    Posted April 8, 2008 at 12:30 pm | Permalink

    Thank you for your amazing site.

  26. prezent ewinator.pl
    Posted April 25, 2008 at 11:38 am | Permalink

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

  27. Calvin blogbloging.blogspot.com
    Posted April 30, 2008 at 12:16 am | Permalink

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

  28. Rufas rufaswan.com
    Posted May 13, 2008 at 5:08 pm | Permalink

    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?

  29. shorty spis.blogostan.net
    Posted July 31, 2008 at 9:27 am | Permalink

    It does’nt work :(

  30. Uroda aloe.com.pl
    Posted July 31, 2008 at 9:31 am | Permalink

    shorty on my site all work’s ok

  31. Posted September 4, 2008 at 11:25 am | Permalink

    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.

  32. Jordon sitenox.com
    Posted September 11, 2008 at 8:40 am | Permalink

    Theme Preview Plugin is rather good. It is fairly interesting considering the spam crusing about the net. To my mind your job is useful for many people. I hope you continue writing in the same way.

  33. Posted October 16, 2008 at 12:49 pm | Permalink

    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?

  34. bizuteria cyrkon.pl
    Posted December 29, 2008 at 8:47 am | Permalink

    I have problem. It does'nt work

  35. Jacob hairregrowth.multiply.com
    Posted January 8, 2009 at 6:23 am | Permalink

    It is very nice that we have this time a choice. I agree with the others that it is a really good theme. But we need some more examples.

  36. Posted December 23, 2009 at 1:06 pm | Permalink

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

  37. Alex wordpressthemesdl.com
    Posted January 11, 2010 at 11:55 am | Permalink

    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 ?

14 Trackbacks

  1. By phil ringnalda dot com on March 12, 2005 at 6:47 am

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

  2. [...] 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 [...]

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

  4. [...] 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. [...]

  5. By WordPress Plugin - Massor av bra WordPress plugins on November 5, 2007 at 7:55 pm

    [...] 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. [...]

  6. [...] 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: [...]

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

  8. By Theme Preview_Wordpress plugin on January 22, 2008 at 9:26 am

    [...] Plugin Homepage [...]

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

  10. By geek ramblings » WordPress 2.5 Beta on March 2, 2008 at 9:51 pm

    [...] (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 [...]

  11. By wordpress plugins | what i use | phoFuki on March 4, 2008 at 8:28 pm

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

  12. [...] 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! [...]

  13. [...] 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 [...]

  14. By Karrai on January 9, 2010 at 8:11 pm

    [...] 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. [...]

Post a Comment

Your email is never published nor shared.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

  • Subscribe

  • Follow Me

    Twitter  Facebook  Flickr  Last.fm  LinkedIn  StumbleUpon  Technorati  Delicious  
  • Referrals

    Sign up for Text Link Ads and earn money from your blog.
  • Lifestream

    • Anybody know where I can get an apt for PHP > 5.2.6 for Ubuntu Jaunty (without upgrading to Karmic?) [dougal]
      56m ago via Twitter
    • Crap. A bug in the Unbuntu 9.04 version of PHP has caused me to waste several hours. I hate when that happens. [dougal]
      57m ago via Twitter
    • Every time the @BaskinRobbins "Ice Cream and Cake" commercial comes on, our kids all break into spontaneous song and dance. Hilarious! [dougal]
      19h ago via Twitter
    • Today for me will be all about XML. I'm trying to maintain a positive attitude about that :) [dougal]
      1d ago via Twitter
    • @ryanolson I'll be working on a new version of the Fancybox Gallery plugin soon, with user-configurable options. [dougal]
      1d ago via Twitter