Epic Theme Viewer

By Alex on July 15 2008 | Listed under Downloads, Plugin, WordPress | 10 Comments

The New Theme Viewer
The beta versions and release candidates of WordPress 2.6 have a really cool new feature when choosing a theme to activate. A working version of the new theme is available in a thickbox, and I love this feature!

I decided to make a front end implementation of the themes.php page of the admin pages, and I modified a few files to do so. I have removed the activate links that you will find in the admin pages, and added some css to give the display some basic styling. This has only been tested on, and will only work on, Wordpress 2.6!

I have several directions that I want to take this in, but for the moment I have written a simple plugin that will create a display of all the themes in your wp-content/themes/ directory. You can view the demo here

My eventual intention is that I will develop this plugin into one that can be used for those who offer themes for download, so that it can be used instead of a separate database/install to demonstrate their themes, but I wanted to get this out there now!! Who knows, maybe the official theme browser might adopt a similar technique, it certainly needs something doing to it!

Usage

  1. Unzip epicthemeviewer.zip and upload to your plugin folder.
  2. Go to the plugin management page and activate ‘Epic Theme Viewer’.
  3. Add into a page template. See example below.
  4. Create a page where you want to add the theme viewer, and assign your new Page Template to it.
  5. Enjoy!

Example Page Template

The example below uses the default K2 theme.



Customisation

If you want to change the amount of columns of themes, open up epicthemeviewer.php and find these lines, changing the number 2 to whatever you want.

$rows = ceil(count($theme_names) / 2);

for ( $col = 1; $col <= 2; $col++ )

if ( $col == 2 ) $class[] = 'right';

By default, only 15 themes are shown per page, but you can change this here:

$per_page = 15;

I'd really love some feedback on this, especially ways to improve the plugin/directions to take the project in.

Issues

Annoyingly, the plugin will only work for logged in users. I'm trying my best to work out why this is, but can't find any hints as of yet.

Download it here:
Epic Theme Viewer (180)

31 Days to Build a Better Blog Affiliate Link

Did you enjoy this post? If you did, so might others! Please share it!

4 Comments - Add Yours!

  • heytbecom wrote on July 15 2008 at 11:44 pm | Permalink

    i clicked Classic theme’s picture in demo site but always saw Default theme… problem or not?

  • Alex wrote on July 15 2008 at 11:52 pm | Permalink

    @heytbecom – Whoops, I just tried again, and you are right. Because I had been logged in whilst testing, I could see all of them, but I logged out, and only the default was there.

    Fixing it now.

    Thanks for the heads up!

  • David Potter wrote on July 19 2008 at 12:46 am | Permalink

    Very cool! Some suggestions:

    1. Provide an admin page to set the options you describe above. Doing that will allow the plugin to be customized per site (I host multiple sites from the same set of WP files) and is less error-prone. Consider using an array for options (see http://striderweb.com/nerdaphernalia/2008/07/consolidate-options-with-arrays.

    2. When releasing the plugin, include the version number in the file name.

  • Jerry Smith wrote on July 22 2008 at 6:41 am | Permalink

    Thank you for the plugin…I did a little adjustment using another plugin to get it working

Post a Comment

Your email is never published nor shared.

*
*
User Gravatar