Admin Theme Preview

THIS PLUGIN HAS BEEN DISCONTINUED! If you are looking for an alternative, Vladimir Prelovac has written a similar plugin called Theme Test Drive – check it out!

The rest of this page should be considered for archival purposes only and is no longer open or accepting comments. This plugin code will continue to be available from Google Code for anyone to use/modify as they wish without attribution to me in any form. Have at it if you’re interested!

——————————————————————–

The Admin Theme Preview (ATP) plugin for WordPress allows for the preview of any currently installed theme without affecting the “live” blog theme viewable to site visitors. Useful for development and testing of new and existing WordPress themes.

Status: No longer being developed! I no longer run a blog and as such, am no longer developing or maintaining Admin Theme Preview. If someone would like to take over development/maintenance of this addon, feel free to do so! I’d be happy to direct traffic from here to its new home if you drop me a line :)

License: GPL

Download:

Installation Instructions: Unzip and place the “admin-theme-preview.php” file in the wp-content/plugins/ subdirectory of your WordPress installation. Activate the plugin in the WordPress Plugins page, then navigate to “Presentation >> Theme Preview” to preview installed themes.

Upgrade Instructions: Overwrite old version with new version :P

Requirements: WordPress (2.x) or WordPress MU (1.1x or newer), “switch_themes” privileges (generally anyone with an “Administrator” role for a particular blog), and cookies enabled. Additionally, if you wish to use the ATP toolbar, javascript must be enabled and themes must use both “wp_head” and “wp_footer” functions.

Known Issues:

  • This plugin does not work well, if at all, by default with caching plugins enabled such as WP-Cache. If you cannot afford to disable caching while using ATP, you can try downloading the ATP-nocache helper plugin which will attempt to append the string “?atp=nocache” to most WordPress generated links for users with permissions to run the plugin. If you add “?atp=nocache” (without the quotes) as an exception string to your caching plugin, it should allow you to use ATP properly.
  • When used in a WordPress MU installation, all themes are available to be previewed regardless of any theme restrictions otherwise in place.

Support: I am no damn programmer! I am a monkey who knows just enough to be dangerous. If your site blows up as a result, I take no responsibility – ZERO. Do I think it’ll blow up? Not at all, or I wouldn’t use it myself :) This plugin was born of my personal need for such a plugin and is maintained and developed as time and motivation allow. As such, this plugin is officially unsupported. Feedback is welcome, but don’t necessarily expect a response. That said, I generally try to reply if people have questions or problems :)

Lineage: Basically just a re-worked/combined version of Ryan Boren‘s Preview Theme and Theme Switcher plugins (the latter of which was itself adapted from Alex King‘s Style Switcher plugin). They did all the work, I more or less just put a wrapper on the thing :P

Archived Versions:

  • Version 1.0.2 – For WordPress 1.5.x installations
    - Released November 19, 2005
  • [Note: This version is not maintained, buggy, probably some security holes, and may eat your children - I wouldn't suggest using it :P]

Additional archived versions of this plugin can be obtained from the Projects Download Page, courtesy of Google Code.

117 thoughts on “Admin Theme Preview

  1. Oh I love that you added the live indicator because I’m always paranoid I clicked something wrong and everyone will see my work in progress…lol!

  2. Glad you like it :) Let me know what you think about the toolbar. I should probably add a toggle in there ASAP so it’s only visable when you’re actually previewing themes and such, but meh.

  3. Just a little followup comment to tell you that I love love love the little toolbar on the main page and the LIVE indicator. It just makes everything so much faster and less stressful…lol!

  4. Hi Alle – So far i’ve been more focused on adding new features than markup errors (I guess it shows haha). Appreciate you taking the time to fix them :)

    For whatever reason the link you provided throws an Internal Server Error when I try to download it. I’ll check back periodically, but in any case i’ll try to make sure markup is fixed for the next release!

  5. I love the idea of this plugin, but I have a problem. When I enable it, and I’m logged in as admin, it is great. The footer is sweet. But my blog is limited only to logged in users. I have a testing account, whose role is “Subscriber” in WP 2.1.1 parlance.

    This test account, when logged in to view the site, sees the previewed theme, not the live theme.

    Any thoughts? I’d be happy to share passwords or make you an account or something for testing purposes.

    Thanks.

  6. This seems to be a very useful plugin. However, after installing and activating it, when I browse to the Theme Preview tab clicking on any theme brings me to my weblog with the original acitvated theme and not the one to be previewed although the previwed theme is indicated.

    What am I doing wrong here?

  7. Alle: Thanks! Grabbed the zip file from the archive and will take a look at integrating it when I get a chance.

    Danny: Apologies for not responding earlier. Somehow missed your comment notification :/

    I’m able to reproduce the bug you’re seeing and will get it patched up for the next release :) It *should” just be an issue that you have the theme preview cookie set in your browser (the current version of this plugin isn’t clearing cookies on logout – doh) allowing you to see the theme you previously selected when logged in as admin – I don’t believe other users are actually seeing the previewed theme. In either case, i’ll get that fixed!

    Marcus: Interesting. I’m unable to reproduce that behavior so any additional information/testing you can provide would be great.

    Does anything change in subsequent views of the blog, eg: if you refresh the page after it tries to set the new preview theme? I’m curious if header redirection is not functioning properly for you somehow? What browser and version are you using in your tests, and does it happen with all the browsers you have access to or just a particular one?

    Still stumped but happy to help troubleshoot more if I can :)

  8. It seems your plugin is only working properly with the WP-Cache plugin disabled. With WP-Cache enabled it doesn’t work.

    Since I like your plugin very much it would be cool if there would be an option to turn the WP-Cache plugin off only for the administrator using the theme preview.

  9. Appreciate the feedback Marcus – I wasn’t aware that the caching plugins were interfering, but that makes sense.

    I’ve got one possible solution in mind to see if I can work around the cache. Let me play with that and if it works and isn’t too difficult to implement, i’ll see if I can get that into the next version. No guarantees though ;)

    In the mean time, here are a couple of options you might try if you haven’t already:

    – Create a secondary wordpress installation where you can develop independent of your primary website, where caching plugins (and probably the admin theme preview plugin as well) would be unnecessary.

    – Disable caching on your site while use this plugin ;)

  10. Marcus, in case you happen to see this, I played around with WP-Cache2 and found a way that seems to work around the caching issues, albeit it’s not what I would consider an ideal solution. In the WP-Cache2 dialog box, you can add additional exception strings that if matched will NOT be cached. The string “wp-” should be in there by default, but if you add the string “?atp=nocache” to the WP-Cache2 exception list and then add the “?atp=nocache” string to any URL you visit on your website, you should get a non-cached view of the page. For example:

    Instead of http://example.com/blog/ which would be cached, you would type in http://example.com/blog/?atp=nocache and hopefully get an uncached version of the page (and with the proper theme you selected from the Admin Theme Preview plugin).

    I went ahead and whipped up a quick little “helper plugin” for ATP that will automatically append the nocache string from above to most of the WordPress links (the notable exception being the main URL for your blog, though you can append the string manually and it should work).

    You can download the plugin here, activate it, and then once you enter the string into WP-Cache2 and re-enable it, you should be good to go for the most part. Again, it’s not an ideal solution, so I may or may not incorporate it into a future version of the ATP plugin itself, but either way hopefully that works better for you!

  11. hello,

    I just found, installed and tested your plugin but I found another problem: it did not work, just shoed me again my site with the live theme… I had the wp-cache plugin disabled, tried deactivating it and still no go :-(

    btw. I am using wpmu not wp but wpmu is based on wp2.1 / wp2.2 – would you be willing to have a look if I gave you an admin account for a demoblog? Just to have a look, maybe I can get it to work…

    thx
    ovidiu

  12. hello,
    after further testing I found out, that the plugin works with wpmu in the usual plugins folder but wp,mu has another folder called mu-plugins and anything dropped in there is automatically activated.

    As your plugi ndoes not create any tables or whatever I am not sure why it should not work from this folder too. It might be a cookie problem? I’ll look into this and if you want to help I can give you an admin login for a demo blog.

  13. Hi ovizii,

    I’ll download WPMU and play around with it and see if it’s an easy change to get it working in the mu-plugins folder. If it’s a quick fix, it’ll be in the next version of the plugin which should be released this week some time, but I can’t guarantee anything. Hopefully it’ll be an easy change :)

  14. Man, this plugin is a godsend. I was beginning to think i would have to set up another WordPress installation, just to test new themes. Thanks a lot, mate!

  15. :-) I would give you any help you need as this is a perfect plugin for a wpmu installation, where you give away free blogs as the users can preview their themes before selecting them – if you need help with wpmu just ask.

  16. Ron: Glad it’s working out for you :) Always neat to hear someone else is using it!

    ovizii: Got it working on WPMU :) You were dead-on that it was a cookie issue. Currently going about trying to see how I want to integrate it, but I don’t see that taking long so it should be in the next release of this plugin later this week!

  17. Great Plugin, thanks for that. I installed it and now I can work better. My own Theme is nearly finished.
    Greets from Germany!

  18. thx

    the new version works flawless out of the mu-folder. regarding the non-existant-restriction-checks to see if user is allowed to use a certain theme, thats peanuts, as long as he cannot use the theme, I don’t min him previewing it :-)

  19. I disabled WP-Cache but it is not updating the “previewing” theme – it stays on the one theme – odd – I really want this to work since I can see how unbelievably useful this plugin will be!

  20. Wendy, not sure why that’s happening offhand, but here are a few more things you can try:

    – Make sure you’re allowing cookies from the site you’re running Admin Theme Preview on. Verify that it’s actually setting cookies by checking your browser settings if possible.

    – Delete any files in wp-cache’s cache. You can remove them via the wp-cache options page in WordPress.

    – Hit shift-reload at your website which will force your browser to re-download all the files from the webserver.

    – Try using a different browser and/or a different computer.

    – Temporarily disable all other WordPress plugins except for Admin Theme Preview and see if that helps.

    – Follow the steps I outline in the “Caveats” section of this page, including downloading the helper plugin and then clicking on some of the internal links it generates.

    – Ask your webhost if they can help troubleshoot the issue.

    Let me know if any of those work!

  21. Love the new version. One quibble, though. When I select a theme to preview, from the admin side, it loads my blog’s url with “/wordpress/” on the end. My blog is located at “/” and says so in the General options admin panel. As a result, when I hit the theme name to preview, it always gives me my theme, but it shows me my 404 page.

    There’s another bloginfo variable for the blog’s url, as opposed to the url for the wordpress install. I don’t remember exactly… (one quick Google search later) you’re probably using bloginfo(‘wpurl’) and you should be using bloginfo(‘url’) or vice versa. Maybe you could switch which one ATP uses, for the next version?

    Thanks.

  22. Hi Danny – I had fixed that in the dev version i’m using, so I just decided to upload that, atp version 2.2.1. It also makes some other changes, the most noticeable is that the toolbar now defaults to the top of the page if you’re using it.

    In any case, appreciate the notification and hopefully this version will work better for you :) Let me know if you run into any problems!

  23. excellent tool! Very neat!
    I have just started to use it, I’ll come back to let you know if I can propose any updates, but it really is a nice tool.

  24. Love the plugin – been using through all your releases – great job.

    Seems to have a problem with any browser on Windows (IE6 and 7, Firefox 2, Safari 3) where the preview function does not work (Javascript incompatible ?)

    Shame as it is great for designing on my Mac but when I want to see all those nasty flaws with IE browsers I cannot without putting the design live – kinda defeats the object of the exercise.

    But hey, who does not have problems with Windows ?

  25. Hi again – forget what I just said – it all works fine on all those browsers in windows. The problem I have is a general one but simple.

    When I check the box in the presentation > preview theme settings in the admin screen, so I get the drop down, it is not saved so only works for that session. If I log out and back in it loses the setting.

    It would be better for me if this set a cookie or was saved to the database so I can always have the preview bar there or not depending on how I last set that choice (hope that makes sense).

    As I said – Great job and invaluable for fiddling with CSS and seeing the changes on my layouts without messing around with development servers. I just copy the current theme and rename it, make changes to the CSS and theme and use your plugin to see what is happening on windows and on Mac browsers – when I am happy I just put it live.

  26. Hi Peter,

    I currently have ATP clearing out all cookies it sets on logout so that’s why you’re seeing that behavior. That said, that probably wouldn’t be a bad idea to retain the settings cookie(s) and just remove the login credentials between sessions so you don’t have to keep clicking the damn button(s)! ;)

    If I get a free moment I’ll see if I can’t get that changed this week some time.

    Appreciate the suggestion!

  27. No, its’s not full compatible, because WP2.5 has a new cooie-management.

    Please bitbybit, correct this.

    Thx

    • It’s half-assed monitored in the hopes that someone will take over ownership of this plugin as I no longer use WordPress. To be honest I’m not even sure if it works with any of the more recent versions of WordPress or if it’s still necessary, but I’ll keep the page up until someone verifies it’s either unnecessary or this plugin is taken over or I’m made aware of an alternative plugin with similar functionality.

Comments are closed.