Change your WP theme for one or more posts or pages

ThemePerPost is ideal for people who want to style their about page, create a unique landing page, show theme previews for design showcases, split one Wordpress install into multiple sub-sites. It's for anyone who wants to have posts and pages with different styles.
All you have to do to change theme for one or more posts or pages is upload the theme you want to use to the usual WP theme directory add a Custom Field to the page/post you want to style. See the Creating a Theme tab for details of how to create a new theme and to use an existing one.
You can see a demo of this plugin running on my blog. The main site and most of the pages and posts look like this. This plugin is used to theme this post. And this plugin landing page is just a themed WP page.

How to install the ThemePerPost plugin

You install this plugin in the same way as you do almost every other WP plugin:

  1. Download it from here and unzip it.
  2. Upload the themeperpost.php file to your Wordpress plugins directory. If you want to keep things tidy you can upload the themeperpost directory instead, but it's not necessary.
  3. Activate the plugin from the WP admin panel.

How to use the ThemePerPost plugin

To use this plugin you need to do two things:

  1. Upload a new theme to use.
  2. Tell WP which posts or pages are to be shown with the new theme.
Uploading a new theme

This plugin uses standard WP themes. All you need to do is upload a new theme to your WP themes directory and take a note of the directory name that you just uploaded.

Telling WP to use it

When you write a post or page you simply need to add a Custom Field to it to get this plugin to switch theme. The custom field name is themeperpost and the value must be the theme directory name you want to use. For example, the image below shows a custom field called themeperpost being added for a theme called carpet.

Changelog

14/01/10 --- Version 1.1.1

Updated so that get_template_directory_uri() and get_template_directory() calls use the right theme dir.

07/01/10 --- Version 1.1.0

Corrected for use with existing themes. Added themeperpost_get_header(), themeperpost_get_sidebar() and themeperpost_get_footer() to be used in place of get_header(), get_sidebar() and get_footer() in theme files.

07/01/10 --- Version 1.0.1

Change so that calls to bloginfo('template_url') now work.

04/01/10 --- Version 1.0.0

First public release.

Creating a theme

Using an existing theme

ThemePerPost works with any WP theme so you can install any new theme as you normally would and style individual pages and posts to use is by adding a Custom Field (see How To Use it).

If the theme you upload uses seperate header, sidebar or footer files - and most of them do - you will need to make a few small changes to your theme. If you are displaying a post then make the following changes to single.php, if you are displaying a page then make following changes to page.php:

  1. Replace call to get_header() with a call to themeperpost_get_header()
  2. Replace call to get_sidebar() with a call to themeperpost_get_sidebar()
  3. Replace call to get_footer() with a call to themeperpost_get_footer()

You can find out more about using Wordpress themes here.

Rolling your own

By default, Wordpress expects a Page to be displayed by a file called page.php and a Post to be displayed using single.php.

You can create simple themes for your pages/posts by creating a directory with only page.php or single.php in it. Here's an example of a simple theme for a post.