<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rabbit Creative &#187; word press development</title>
	<atom:link href="http://www.rabbitcreative.com/category/word-press-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rabbitcreative.com</link>
	<description>ruby, rails, objects and &#60;del&#62;politics&#60;/del&#62; markets</description>
	<lastBuildDate>Fri, 20 Aug 2010 17:57:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Change your WordPress theme programmatically.</title>
		<link>http://www.rabbitcreative.com/2009/09/18/change-your-wordpress-theme-programmatically/</link>
		<comments>http://www.rabbitcreative.com/2009/09/18/change-your-wordpress-theme-programmatically/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 23:14:26 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
				<category><![CDATA[word press development]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/?p=288</guid>
		<description><![CDATA[First, WordPress is the devil. And all those who spend time developing WordPress, or developing for WordPress, are slaves to his cock. Yes, that means I, too, must suckle the beast&#8217;s meat from time to time. However, I am determined to make my suffering worth something. I will share my experiences with you, in the [...]]]></description>
			<content:encoded><![CDATA[<p>First, WordPress is the devil. And all those who spend time developing WordPress, or developing for WordPress, are slaves to his cock. Yes, that means I, too, must suckle the beast&#8217;s meat from time to time. However, I am determined to make my suffering worth something. I will share my experiences with you, in the hopes that doing so will minimize the amount of time you spend with your lips wrapped around that totem pole of evil. That said&#8230;</p>
<p>If you want to programmatically change your WordPress theme (ONLY tested with WP 2.8), there are two sets of steps. The first set includes gathering data &#8212; no actual code is written, but you should write down two important values. Here are the first 4 steps:</p>
<p><strong>Step 1</strong><br />
Identify the theme you wish to use. Do this even if you want to let your end-user decide between multiple themes. This step is required for a conceptual understanding of what you are doing.</p>
<p><strong>Step 2</strong><br />
Locate the theme under wp-content/themes/. Note the theme&#8217;s directory name (e.g. &#8220;classic&#8221;, &#8220;default&#8221;, &#8220;skinbu&#8221;, etc.). You will use this value later.</p>
<p><strong>Step 3</strong><br />
Within the theme&#8217;s directory will be a style sheet, most probably named &#8220;style.css&#8221;. Open it.</p>
<p><strong>Step 4</strong><br />
Inside the style sheet, towards the top, you should see a line similar to &#8220;Theme Name: WordPress Default&#8221;. Note the value in place of &#8220;WordPress Default&#8221;. You will use this value later.</p>
<p><strong>Intermission</strong><br />
The next set of steps involves some database action, along with any other additional programming you may want for your particular application of this idea. The basic flow is to update two fields with the value of the theme&#8217;s directory, delete the existing current_theme option, then recreate it with the &#8220;Theme Name&#8221; value inside the theme&#8217;s style sheet. Here we go.</p>
<p><strong>Step 5</strong><br />
Issue a query similar to the following:</p>
<p><code lang="sql">
<pre>UPDATE `wp_options` SET `option_value` = 'value from step 2' WHERE `option_name` = 'template'</pre>
<p></code></p>
<p>Replace &#8220;value from step 2&#8243; with the value you obtained from step  2 above.</p>
<p><strong>Step 6</strong><br />
Issue a query similar to the following:</p>
<p><code lang="sql">
<pre>UPDATE `wp_options` SET `option_value` = 'value from step 2' WHERE `option_name` = 'stylesheet'</pre>
<p></code></p>
<p>Replace &#8220;value from step 2&#8243; with the value you obtained from step 2 above.</p>
<p><strong>Step 7</strong><br />
Issue a query similar to the following:</p>
<p><code lang="sql">
<pre>DELETE FROM wp_options WHERE option_name = 'current_theme'</pre>
<p></code></p>
<p><strong>Step 8</strong><br />
Issue a query similar to the following:</p>
<p><code lang="sql">
<pre>INSERT INTO `wp_options` (`option_name`,`option_value`,`autoload`) VALUES ('current_theme','value from step 4','yes')</pre>
<p></code></p>
<p>Replace &#8220;value from step 4&#8243; with the value you obtained in step 4 above.</p>
<p>Done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2009/09/18/change-your-wordpress-theme-programmatically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
