<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Jeremy Clark - TechNet.com</title>
	
	<link>http://clark-technet.com</link>
	<description />
	<lastBuildDate>Wed, 11 Jan 2012 16:33:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/clark-technet/bRdG" /><feedburner:info uri="clark-technet/brdg" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license><image><link>http://clark-technet.com</link><url>http://clark-technet.com/logo.jpg</url><title>Jeremy Clark - TechNet.com</title></image><feedburner:emailServiceId>clark-technet/bRdG</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Holiday Shopping Tips</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/TCd6cQzkywA/holiday-shopping-tips</link>
		<comments>http://clark-technet.com/2011/12/holiday-shopping-tips#comments</comments>
		<pubDate>Wed, 21 Dec 2011 18:54:54 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=527</guid>
		<description><![CDATA[During the holiday seasons countless people spend more and more money online. Online shopping is becoming more popular, for many reasons. It&#8217;s easier than fighting crowds at large stores. Many online stores run special sales during holidays. Overall it&#8217;s just a more convenient way to shop, but the convenience could also have a price. Scams [...]]]></description>
			<content:encoded><![CDATA[<p>During the holiday seasons countless people spend more and more money online.  Online shopping is becoming more popular, for many reasons.  It&#8217;s easier than fighting crowds at large stores.  Many online stores run special sales during holidays.  Overall it&#8217;s just a more convenient way to shop, but the convenience could also have a price.  Scams and phishing attempts rise during holidays.  There are a few simple steps that can be taken to reduce the risks.
<ul>
<li>Always be sure of the website your visiting.  IE Bookmark your favorite store&#8217;s website.</li>
<li>If that email offer seems to good to be true, it usually is.</li>
<li>Always verify offers from the retailer&#8217;s website.</li>
<li>When checking out verify the payment method</li>
<li>Probably the most important is to use a good security software to protect your computer from malware that could compromise your personal information</li>
<p><span id="more-527"></span><br />
<a href="http://uk.trendmicro.com/uk/about/infographics/safety-tips-for-online-shopping/"><img src="http://uk.trendmicro.com/imperia/md/images/uk/aboutus/infographics/shop-safely-online.jpg"/></a><br/>Via: <a href="http://uk.trendmicro.com">Trend Micro</a></p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/wQtYV5DT7FkCtgxj6skdU-asMNw/0/da"><img src="http://feedads.g.doubleclick.net/~a/wQtYV5DT7FkCtgxj6skdU-asMNw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/wQtYV5DT7FkCtgxj6skdU-asMNw/1/da"><img src="http://feedads.g.doubleclick.net/~a/wQtYV5DT7FkCtgxj6skdU-asMNw/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=TCd6cQzkywA:RLqh0gDuVYw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=TCd6cQzkywA:RLqh0gDuVYw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=TCd6cQzkywA:RLqh0gDuVYw:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=TCd6cQzkywA:RLqh0gDuVYw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=TCd6cQzkywA:RLqh0gDuVYw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=TCd6cQzkywA:RLqh0gDuVYw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/TCd6cQzkywA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2011/12/holiday-shopping-tips/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2011/12/holiday-shopping-tips</feedburner:origLink></item>
		<item>
		<title>Making Theme Widget Areas More Dynamic</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/1clkzPsbJgM/making-theme-widget-areas-more-dynamic</link>
		<comments>http://clark-technet.com/2011/10/making-theme-widget-areas-more-dynamic#comments</comments>
		<pubDate>Fri, 21 Oct 2011 14:11:37 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=517</guid>
		<description><![CDATA[Making a horizontal widget area more dynamic.  Instead of hard-coding the widths of each widget and making the layout static, I decided to make it have dynamic widths.  By dynamic I'm not just talking about using percentage widths, but making the widths dependent on how many widgets are added to the area.  By using a built-in WordPress function and some simple php math, dynamic widths can easily be applied.]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.clark-technet.com/wp-content/uploads/2008/10/wordpresstip.jpg" alt="" title="WordPress" width="75" height="75" class="alignleft size-full wp-image-316" />While designing a new theme for a client a problem came up that has come up before.  Making a horizontal area a widgetized area, ie the header area next to a logo.  This could also be in the footer of a theme.  Instead of hardcoded the widths of each widget and making the layout static, I decided to make it have dynamic widths.  By dynamic I&#8217;m not just talking about using percentage widths, but making the widths dependent on how many widgets are added to the area.  Lucky WordPress has a handy function that will give counts of all the widgets currently active and in which area they are active.  The documentation on the function is quite sparse <a href="http://codex.wordpress.org/Function_Reference/wp_get_sidebars_widgets">wp_get_sidebars_widgets</a><span id="more-517"></span></p>
<p>I used this function to roll my own reusable function.</p>
<pre class="brush: php; title: ; notranslate">
function count_widgets($loc){
	$sidebar_widgets = wp_get_sidebars_widgets();
	$num_widgets = 0;
	foreach ( (array) $sidebar_widgets as $k =&gt; $v ){
		if ($loc != $k)
			continue;
		if ( is_array($v))
			$num_widgets = $num_widgets + count($v);
	}
	return $num_widgets;
}
</pre>
<p>Here&#8217;s is how it would be used.  This is added in the header.php in the head section.  What this does is get the number of widgets then divides 100 by this number then subtracts 2 times the number.  The subtraction if for 1% left and right margin that is applied in the stylesheet.  If more is required simply add the left and right together and multiply by the count.  The .header_widget is the class that I used when registering the widget area.  It is seen below.</p>
<pre class="brush: php; title: ; notranslate">
&lt;style type=&quot;text/css&quot;&gt;
&lt;?php $count = count_widgets('header');
$percentage = (100/$count) - ($count * 2);
echo '.header_widget{ width:' . $percentage . '%;}';
?&gt;
&lt;/style&gt;
</pre>
<p>The parameter that is passed to the function is the id of the sidebar or widget area your getting the count for.  To make sure what these values are it&#8217;s easiest to hardcode the ID when registering the sidebar.  The before_widget applies the class that is used to change the width with the styles above.</p>
<pre class="brush: php; title: ; notranslate">
register_sidebar(array(
  'name' =&gt; 'Header',
  'id' =&gt; 'header',
  'description' =&gt; 'Widgets will be shown in the header area.',
  'before_widget' =&gt; '&lt;div class=&quot;header_widget&quot;&gt;',
  'after_widget' =&gt; '&lt;/div&gt;'
));
</pre>
<p>Another way would be to use print_r to view the contents of the output.  Like this:</p>
<pre class="brush: php; title: ; notranslate">$sidebar_widgets = wp_get_sidebars_widgets();
print_r($sidebar_widgets);
</pre>
<p>This will output an array the keys will be the id that should be used.</p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/InPDh5byb_eWcob15QmTXirVIYk/0/da"><img src="http://feedads.g.doubleclick.net/~a/InPDh5byb_eWcob15QmTXirVIYk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/InPDh5byb_eWcob15QmTXirVIYk/1/da"><img src="http://feedads.g.doubleclick.net/~a/InPDh5byb_eWcob15QmTXirVIYk/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=1clkzPsbJgM:7MraF3jRKQo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=1clkzPsbJgM:7MraF3jRKQo:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=1clkzPsbJgM:7MraF3jRKQo:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=1clkzPsbJgM:7MraF3jRKQo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=1clkzPsbJgM:7MraF3jRKQo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=1clkzPsbJgM:7MraF3jRKQo:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/1clkzPsbJgM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2011/10/making-theme-widget-areas-more-dynamic/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2011/10/making-theme-widget-areas-more-dynamic</feedburner:origLink></item>
		<item>
		<title>Google Maps API</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/3Sc0EjGndzs/google-maps-api</link>
		<comments>http://clark-technet.com/2011/02/google-maps-api#comments</comments>
		<pubDate>Wed, 02 Feb 2011 21:47:17 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=497</guid>
		<description><![CDATA[In a recent project it was asked to provide a Google map on a number of pages.  It would have been to time consuming to create a custom map and manually place the code on each page.  Instead using the Google Maps API was a better choice because the address could be pulled from a custom field in the post and used to create the map.  The first step is <a href="http://code.google.com/apis/maps/signup.html">signing up</a> for a API key, as with most Google products is free and only requires a Google account.]]></description>
			<content:encoded><![CDATA[<p><span class="alignright"><script type="text/javascript"><!--
google_ad_client = "pub-5880865034974171";
/* 125x125, created 3/13/08 */
google_ad_slot = "7590392760";
google_ad_width = 125;
google_ad_height = 125;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></span><img src="http://static.clark-technet.com/wp-content/uploads/2011/02/google_map-150x119.jpg" alt="" title="Google Map" width="150" height="119" class="alignleft size-thumbnail wp-image-498" />In a recent project it was asked to provide a Google map on a number of pages.  It would have been too time consuming to create a custom map and manually place the code on each page.  Instead using the Google Maps API was a better choice because the address could be pulled from a custom field in the post and used to create the map.  With the code below adding a Google Map is simple.  </p>
<p>The first step is <a href="http://code.google.com/apis/maps/signup.html">signing up</a> for a API key, as with most Google products is free and only requires a Google account.  After you&#8217;ve received your key, you can then edit the functions.php file of your current theme.  The below code has some key spots to take note of and maybe change some values.  I will highlight these after the full code.</p>
<div style="clear:both"></div>
<p><span id="more-497"></span></p>
<pre class="brush: php; highlight: [6,15,20,27,28,29,30,44]; title: ; notranslate">
&lt;?php
add_action('wp_head', 'gmaps_header');

function gmaps_header() {
?&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;http://maps.google.com/maps/api/js?sensor=false&amp;key=YOURAPIKEYGOESHERE&quot;&gt;&lt;/script&gt;
&lt;?php
}

function google_map(){
	global $post;
	$post_id = get_the_ID();
	$address = get_post_meta($post_id, 'address', true);
	if ( !empty ($address ) ){ ?&gt;
		&lt;div id=&quot;google_map&quot; style=&quot;width:500px;height:400px;&quot;&gt;&lt;/div&gt;&lt;br /&gt;
		&lt;form onsubmit=&quot;calcRoute();return false;&quot;&gt;
			&lt;input type=&quot;text&quot; id=&quot;start&quot; value=&quot;&quot;&gt;
			&lt;input type=&quot;submit&quot; value=&quot;Get directions&quot;&gt;
		&lt;/form&gt;&lt;br /&gt;
		&lt;div id=&quot;directionsPanel&quot; style=&quot;width:500px;&quot;&gt;&lt;/div&gt;
		&lt;script type=&quot;text/javascript&quot;&gt;
			var directionDisplay;
			var directionsService = new google.maps.DirectionsService();
			directionsDisplay = new google.maps.DirectionsRenderer();
			var latlng = new google.maps.LatLng(0,0);
			var myOptions = {
				zoom: 7,
				center: latlng,
				mapTypeControl: true,
				mapTypeId: google.maps.MapTypeId.HYBRID
			};
			var google_map = new google.maps.Map(document.getElementById(&quot;google_map&quot;), myOptions);
			directionsDisplay.setMap(google_map);
			directionsDisplay.setPanel(document.getElementById(&quot;directionsPanel&quot;))
			var geocoder_google_map = new google.maps.Geocoder();
			var address = '&lt;?php echo $address ?&gt;';
			geocoder_google_map.geocode( { 'address': address}, function(results, status) {
				if (status == google.maps.GeocoderStatus.OK) {
					google_map.setCenter(results[0].geometry.location);
					var marker = new google.maps.Marker({
						map: google_map,
						position: google_map.getCenter()
						});
						&lt;?php $thiscontent = $address;?&gt;
						var contentString = '&lt;?php echo $thiscontent; ?&gt;';
						var infowindow = new google.maps.InfoWindow({
							content: contentString
						});
						infowindow.open(google_map,marker);
						google.maps.event.addListener(marker, 'click', function() {
							infowindow.open(google_map,marker);
						});

					} else {
						alert(&quot;Geocode was not successful for the following reason: &quot; + status);
					}
				});

			function calcRoute() {
				var address = '&lt;?php echo $address ?&gt;';
				var start = document.getElementById(&quot;start&quot;).value;
				var request = {
					origin:start,
					destination:address,
					travelMode: google.maps.DirectionsTravelMode.DRIVING
				};
				directionsService.route(request, function(response, status) {
				  if (status == google.maps.DirectionsStatus.OK) {
					directionsDisplay.setDirections(response);
				  }
				});
			}
		&lt;/script&gt;
&lt;?php
	}

}?&gt;
</pre>
<p>After you have your API key it will need to be added to this line.</p>
<pre class="brush: php; first-line: 6; title: ; notranslate">	&lt;script type=&quot;text/javascript&quot; src=&quot;http://maps.google.com/maps/api/js?sensor=false&amp;key=YOURAPIKEYGOESHERE&quot;&gt;&lt;/script&gt;</pre>
<p>Here is the container that will hold the map.  The width and height can be changed to better suit the current theme.</p>
<pre class="brush: php; first-line: 15; title: ; notranslate">&lt;div id=&quot;google_map&quot; style=&quot;width:500px;height:400px;&quot;&gt;&lt;/div&gt;&lt;br /&gt;</pre>
<p>The same with this line, which holds the driving directions panel.  Here only a width is specified to allow the directions to use as much height as needed.</p>
<pre class="brush: php; first-line: 20; title: ; notranslate"> &lt;div id=&quot;directionsPanel&quot; style=&quot;width:500px;&quot;&gt;&lt;/div&gt;</pre>
<p>If driving directions aren&#8217;t need the simply removing these lines will remove the form and the container for the directions.</p>
<pre class="brush: php; first-line: 16; title: ; notranslate">	&lt;form onsubmit=&quot;calcRoute();return false;&quot;&gt;
	&lt;input type=&quot;text&quot; id=&quot;start&quot; value=&quot;&quot;&gt;
	&lt;input type=&quot;submit&quot; value=&quot;Get directions&quot;&gt;
	&lt;/form&gt;&lt;br /&gt;
	&lt;div id=&quot;directionsPanel&quot; style=&quot;width:500px;&quot;&gt;&lt;/div&gt;
</pre>
<p>Another important section is the map options themselves.  Zoom controls the how far the map is zoomed by default, mapTypeControl tells whether or not you want the controls for zoom and changing map type on the map.  The mapTypeId tells what kind of map you want displayed by default, HYBRID is the satellite view with the roads overlayed.  A list of possible mapTypeId is <a href="http://code.google.com/apis/maps/documentation/javascript/reference.html#MapTypeId">here</a>.</p>
<pre class="brush: php; first-line: 27; title: ; notranslate">				zoom: 7,
				center: latlng,
				mapTypeControl: true,
				mapTypeId: google.maps.MapTypeId.HYBRID
</pre>
<p>The marker content can be customized by setting the $thiscontent variable.  The address is shown by default, but any html can be added to the marker.  Other things you might consider is the places name, phone number, this can all be set via custom fields, and appended to the $thiscontent variable.</p>
<pre class="brush: php; first-line: 44; title: ; notranslate">						&lt;?php $thiscontent = $address;?&gt;</pre>
<p>After you&#8217;ve customized and added the code to your functions.php file, you can then edit your single.php and use this to display the maps where you would like.</p>
<pre class="brush: php; light: true; title: ; notranslate">&amp;lt;?php echo google_map(); ?&amp;gt;</pre>
<p>Then in your post just add a custom field with the name address and the contents a valid and correctly formated address, the code will do the rest. </p>
<h4>Resources:</h4>
<p><a href="http://code.google.com/apis/maps/documentation/javascript/reference.html">Maps API Reference</a></p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/sYkN6y1jUx-YZkW_cA2VakNc1HI/0/da"><img src="http://feedads.g.doubleclick.net/~a/sYkN6y1jUx-YZkW_cA2VakNc1HI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/sYkN6y1jUx-YZkW_cA2VakNc1HI/1/da"><img src="http://feedads.g.doubleclick.net/~a/sYkN6y1jUx-YZkW_cA2VakNc1HI/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=3Sc0EjGndzs:KJqXHjovM7k:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=3Sc0EjGndzs:KJqXHjovM7k:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=3Sc0EjGndzs:KJqXHjovM7k:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=3Sc0EjGndzs:KJqXHjovM7k:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=3Sc0EjGndzs:KJqXHjovM7k:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=3Sc0EjGndzs:KJqXHjovM7k:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/3Sc0EjGndzs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2011/02/google-maps-api/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2011/02/google-maps-api</feedburner:origLink></item>
		<item>
		<title>WordPress Self-Hosted Plugin Update API</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/7quuPmYc5b8/wordpress-self-hosted-plugin-update-api</link>
		<comments>http://clark-technet.com/2010/12/wordpress-self-hosted-plugin-update-api#comments</comments>
		<pubDate>Fri, 17 Dec 2010 15:01:37 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=489</guid>
		<description><![CDATA[Have a plugin that can&#8217;t be submitted to the official repository? Code is now on GitHub please see here for updated version. Many reasons exist but the biggest is that the plugin/support is sold therefore can&#8217;t be downloaded for free. But why should the end user be punished after all they bought the plugin and [...]]]></description>
			<content:encoded><![CDATA[<p>Have a plugin that can&#8217;t be submitted to the official repository?</p>
<p><strong>Code is now on GitHub please see <a href="https://github.com/jeremyclark13/automatic-theme-plugin-update">here</a> for updated version.</strong></p>
<p>Many reasons exist but the biggest is that the plugin/support is sold therefore can&#8217;t be downloaded for free.  But why should the end user be punished after all they bought the plugin and updates should be just as seamless as from the official repo.  With this script this can be accomplished.  Examples and a package of sample code can be downloaded below.<br />
<span id="more-489"></span><br />
The original idea and code came from <a href="http://konstruktors.com/blog/wordpress/2538-automatic-updates-for-plugins-and-themes-hosted-outside-wordpress-extend/">konstruktors.com</a>, but I&#8217;ve modified it to add more info and fixed a couple of errors with it.  The package containing all the sample code can be downloaded <a href='https://github.com/jeremyclark13/automatic-theme-plugin-update/zipball/master'>here</a> from GitHub.</p>
<p>First I&#8217;ll explain the code that goes onto the update server, this code is found in the api folder of the zip file.  Basically you&#8217;ll just need to edit and upload the api/index.php file to your server somewhere and then in the update files of your theme/plugin point to that directory. </p>
<h3>Theme Update</h3>
<p>The theme in $packages['theme'] will need to replaced with your theme&#8217;s slug most likely it&#8217;s theme folder name.  This is what is sent to the update server to check for updates.  Next you have a versions array.  You&#8217;ll need to change the 1.0 both places to match the version of the update that is available.  Next is the date that the update was published.  Not really used in theme updates but still handy to have.  Next is the important part the url to the zip file for the update that will be pulled down by WordPress and installed.  The info array below this is where you can specifiy a url that will display the theme and some info about it.  Normally for themes from the offical repo this will display the page from the extend section.  </p>
<pre class="brush: php; title: ; notranslate">
// Theme with update info
$packages['theme'] = array(
	'versions' =&gt; array(
		'1.0' =&gt; array(
			'version' =&gt; '1.0',
			'date' =&gt; '2010-04-10',
			'package' =&gt; 'http://url_to_your_site/theme.zip'  // The zip file of the theme update
		)
	),
	'info' =&gt; array(
		'url' =&gt; 'http://url_to_your_theme_site'  // Website devoted to theme if available
	)
);
</pre>
<h3>Plugin Update</h3>
<p>Now onto the plugin section of the api/index.php file.  The plugin in $packages['plugin'] will need to be replaced with the plugin&#8217;s slug, usually the folder name of the plugin itself.  Next is the versions array where 1.0 will need to replaced both time with the version that is in the zip file for the update.  </p>
<ul>
<li>version: version of the update</li>
<li>date: date the update was published this is used in the plugin details section. </li>
<li>author: full name of the author or company publishing the plugin. </li>
<li>requires: minimum version of WordPress needed for the plugin to function properly. </li>
<li>tested:  the version of WordPress the plugin has been tested with.  </li>
<li>homepage: authors homepage.</li>
<li>downloaded: download counter used by wordpress.org but not by the self update api, can be any number.</li>
<li>external: link to the page devoted to plugin.</li>
<li>package: url to the zip file for the update.</li>
<li>sections: is an array to hold the extra info for the plugin details page generated by WordPress. </li>
<ul>
<li>description: Description of Plugin.</li>
<li>installation: Install Info</li>
<li>&#8230;</li>
<li>Any section can be added not just the ones listed.  The first field in the array ie before the => is used as the title of the tab in the plugin info page.  The next section is used in the body of the tab.</li>
</ul>
</ul>
<pre class="brush: php; title: ; notranslate">
// Plugin with update info
$packages['plugin'] = array(
	'versions' =&gt; array(
		'1.0' =&gt; array(
			'version' =&gt; '1.0',
			'date' =&gt; '2010-04-10',
			'author' =&gt; 'Author Name',
			'requires' =&gt; '2.8',  // WP version required for plugin
			'tested' =&gt; '3.0.1',  // WP version tested with
			'homepage' =&gt; 'http://your_author_website',  // Your personal website
			'downloaded'=&gt; '1000',  // Number of times downloaded
			'external' =&gt; 'http://your_plugin_website',  // Site devoted to your plugin if available
			'package' =&gt; 'http://url_to_your_site/plugin.zip',  // The zip file of the plugin update
			'sections' =&gt; array(
				'description' =&gt; 'Description of Plugin',
				'installation' =&gt; 'Install Info',
				'screen shots' =&gt; 'Screen Shots',
				'change log' =&gt; 'Change log',
				'faq' =&gt; 'FAQ',
				'other notes' =&gt; 'Other Notes'
				)
		)
	),
	'info' =&gt; array(
		'url' =&gt; 'http://your_plugin_webiste'  // Site devoted to your plugin if available
	)
);
</pre>
<h3>Theme Update script</h3>
<p>Now for the script that will need to be added to your theme for the theme to be able to check back to your server for updates.  There is a folder called theme/theme-update/ that has a update.php file that is all that is needed.  It need to be edited and included from your functions.php file.  The value that needs to be edited is $api_url.  $api_url is the url to the api/index.php file that you&#8217;ve uploaded to your server somewhere. There is also a debug function at the top to reset the transient used for theme updates so that WordPress will check every page load for updates.  The should only be used for testing, and should be removed from actual production code, as it would cause massive amounts of traffic to your site.</p>
<pre class="brush: php; title: ; notranslate">/**/
// TEMP: Enable update check on every request. Normally you don't need this! This is for testing only!
//set_site_transient('update_themes', null);

add_filter('pre_set_site_transient_update_themes', 'check_for_update');

function check_for_update($checked_data) {
	global $wp_version;

	/******************Change this*******************/
	$api_url = 'http://UPDATE SERVER.com/';
	/************************************************/
</pre>
<h3>Plugin Update script</h3>
<p>In the zip package there is a folder test-plugin-update which contains a file called test-plugin-update.php  Which is a full plugin but doesn&#8217;t do anything except check for updates to itself.  The code can just be placed into existing plugin files or into a new file and included from the main plugin file.  The plugin update only require one variable be changed $api_url which is the path to the api/index.php file on your update server.  This also has the function to check for updates every page load and should be removed from production code.  Basically the plugin update has two main functions.  One checks for the update the other takes the info from the update check and places it into the plugin update details screen.  </p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/RI4qsBhuBeaWrdNRV1A6sCahhoU/0/da"><img src="http://feedads.g.doubleclick.net/~a/RI4qsBhuBeaWrdNRV1A6sCahhoU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/RI4qsBhuBeaWrdNRV1A6sCahhoU/1/da"><img src="http://feedads.g.doubleclick.net/~a/RI4qsBhuBeaWrdNRV1A6sCahhoU/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=7quuPmYc5b8:W5d320ySrxQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=7quuPmYc5b8:W5d320ySrxQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=7quuPmYc5b8:W5d320ySrxQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=7quuPmYc5b8:W5d320ySrxQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=7quuPmYc5b8:W5d320ySrxQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=7quuPmYc5b8:W5d320ySrxQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/7quuPmYc5b8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/12/wordpress-self-hosted-plugin-update-api/feed</wfw:commentRss>
		<slash:comments>46</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/12/wordpress-self-hosted-plugin-update-api</feedburner:origLink></item>
		<item>
		<title>WordPress Theme Developers Tip – Theme Update Noticifications</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/dYeny_bMuM4/wordpress-theme-developers-tip-theme-update-noticifications</link>
		<comments>http://clark-technet.com/2010/09/wordpress-theme-developers-tip-theme-update-noticifications#comments</comments>
		<pubDate>Fri, 17 Sep 2010 12:58:41 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=487</guid>
		<description><![CDATA[While doing some work for a client, they were wanting to tie into the update notifications that a user gets when a theme has an updated version in the WordPress theme directory. The catch is this was a premium theme that was being sold so couldn&#8217;t be submitted to the directory. While not as robust [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.clark-technet.com/wp-content/uploads/2008/10/wordpresstip.jpg" alt="" title="WordPress" width="75" height="75" class="alignleft size-full wp-image-316" />While doing some work for a client, they were wanting to tie into the update notifications that a user gets when a theme has an updated version in the WordPress theme directory.  The catch is this was a premium theme that was being sold so couldn&#8217;t be submitted to the directory.  While not as robust as the WordPress update system it doesn&#8217;t need to be most premium themes require you to log in to download updates.  So a simple notification was sufficient.  Please read more to see code and explanations.<span id="more-487"></span></p>
<div style="clear:both"></div>
<ul class="download alignleft">
<li class="aligncenter"><a href='http://static.clark-technet.com/wp-content/uploads/2010/09/update-notice.php_.zip'>Download</a></li>
</ul>
<div style="clear:both"></div>
<pre class="brush: php; title: ; notranslate">
&lt;?php
add_action('admin_head','theme_check_ver'); //Theme Update Function
/****************************
Update Noticication Script
By Jeremy Clark

http://clark-technet.com

License: GPL
*****************************/

/*********************VALUES BELOW NEED TO BE CHANGED*************************/
$theme_sn= &quot;theme-short-name&quot;;
//Theme's short name for adding options to database
$remote_file = &quot;http://address-to-remote-server/theme-version.txt&quot;;
//Address of remote file with version number
$update_check_int = 24;
// Time in hours to check file for new version
$theme_update_notice =&quot;&lt;p&gt;New theme version available.  Please visit here for the download.&lt;/p&gt;&quot;;
//Text for notice displayed to user about new version
/*********************END EDITING*********************************************/

//These variables don't need editing
$theme_data = get_theme_data(TEMPLATEPATH . '/style.css');
$local_version = $theme_data['Version'];
$update_last_check = get_option($theme_sn.'_last_ver_check');
$new_ver_notice = get_option($theme_sn.'_new_ver');

function theme_check_ver() {
	global $update_check_int, $update_last_check,$new_ver_notice,$theme_sn;
		if ($new_ver_notice = true) {
			add_action('admin_notices','theme_new_ver');
		}
		$update_check_int_seconds = $update_check_int * 3600;
		$now = time();
		if ( empty( $update_last_check ) ) {
				//first run
				theme_compare_ver();
				add_option($theme_sn.'_last_ver_check', $now);
			} else {
				$time_ago = $now - $update_last_check;
				if ( $time_ago &gt; $update_check_int_seconds ) {
					theme_compare_ver();
					update_option($theme_sn.'_last_ver_check', $now);
				}
			}
}
function theme_compare_ver() {
	global $remote_file, $local_version,$theme_sn;
		$remote_text = file_get_contents($remote_file);
		if ($remote_text !== false) {
			$remote_version = $remote_text;
		if ($local_version == $remote_version) {
				delete_option($theme_sn.'_new_ver');
			} else {
				if ( is_numeric(str_replace(&quot;.&quot;, &quot;&quot;, $local_version)) &amp;&amp; is_numeric(str_replace(&quot;.&quot;, &quot;&quot;, $remote_version)) ) {
					if ( substr_count($local_version, '.') == 0 ) {
						// x -&gt; x.x.x.x
						$local_version = $local_version . '.0.0.0';
					} else if ( substr_count($local_version, '.') == 1 ) {
						// x.x -&gt; x.x.x.x
						$local_version = $local_version . '.0.0';
					} else if ( substr_count($local_version, '.') == 2 ) {
						// x.x.x -&gt; x.x.x.x
						$local_version = $local_version . '.0';
					}
					$local_version = str_replace(&quot;.&quot;, &quot;&quot;, $local_version);
					//$local_version = substr($local_version,0,1) . '.' . substr($local_version,1,5);
					$local_version = '0.' . $local_version;
					//---------------//
					if ( substr_count($remote_version, '.') == 0 ) {
						// x -&gt; x.x.x.x
						$remote_version = $remote_version . '.0.0.0';
					} else if ( substr_count($remote_version, '.') == 1 ) {
						// x.x -&gt; x.x.x.x
						$remote_version = $remote_version . '.0.0';
					} else if ( substr_count($remote_version, '.') == 2 ) {
						// x.x.x -&gt; x.x.x.x
						$remote_version = $remote_version . '.0';
					}
					$remote_version = str_replace(&quot;.&quot;, &quot;&quot;, $remote_version);
					//$remote_version = substr($remote_version,0,1) . '.' . substr($remote_version,1,5);
					$remote_version = '0.' . $remote_version;
					//---------------//
					//echo $remote_version . ' - ' . $local_version . '&lt;br /&gt;';
					if ( $remote_version &gt; $local_version ) {
						add_action('admin_notices','theme_new_ver');
						add_option($theme_sn.'_new_ver',true);
					} else {
						del_option($theme_sn.'_new_ver');
					}
				} else {
					add_action('admin_notices','theme_new_ver');
					add_option($theme_sn.'_new_ver',true);
				}
			}
		} else {
			echo &quot;Can't Connect to update server&quot;;
		}
}	

function theme_new_ver() {
	global $theme_update_notice, $pagenow;
	if ( $pagenow == &quot;themes.php&quot;) {
?&gt;
		&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;
		&lt;?php echo $theme_update_notice; ?&gt;
		&lt;/div&gt;
&lt;?php
	}
}
?&gt;
</pre>
<p>Then the update-notice.php file will need to be included from your functions.php file in your theme.  </p>
<pre class="brush: php; light: true; title: ; notranslate">
if ( is_admin() ) {
    include_once (TEMPLATEPATH . '/update-notice.php');
}
</pre>
<p>There are a few values in the top of the file that would need to change to reflect the theme it&#8217;s checking for.  The theme-version.txt on the remote server simply contains the theme version that is available for release.  The script checks and if it&#8217;s lower than the remote version it will display the $theme_update_notice variable with the text that you specify on the top of the themes.php page.</p>
<pre class="brush: php; title: ; notranslate">
/*********************VALUES BELOW NEED TO BE CHANGED*************************/
$theme_sn= &quot;theme-short-name&quot;;
//Theme's short name for adding options to database
$remote_file = &quot;http://address-to-remote-server/theme-version.txt&quot;;
//Address of remote file with version number
$update_check_int = 24;
// Time in hours to check file for new version
$theme_update_notice =&quot;&lt;p&gt;New theme version available.  Please visit here for the download.&lt;/p&gt;&quot;;
//Text for notice displayed to user about new version
/*********************END EDITING*********************************************/
</pre>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/DMdVUZEzH0qhyM8-2zY_70gmxgM/0/da"><img src="http://feedads.g.doubleclick.net/~a/DMdVUZEzH0qhyM8-2zY_70gmxgM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/DMdVUZEzH0qhyM8-2zY_70gmxgM/1/da"><img src="http://feedads.g.doubleclick.net/~a/DMdVUZEzH0qhyM8-2zY_70gmxgM/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=dYeny_bMuM4:-RLfGNh838s:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=dYeny_bMuM4:-RLfGNh838s:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=dYeny_bMuM4:-RLfGNh838s:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=dYeny_bMuM4:-RLfGNh838s:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=dYeny_bMuM4:-RLfGNh838s:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=dYeny_bMuM4:-RLfGNh838s:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/dYeny_bMuM4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/09/wordpress-theme-developers-tip-theme-update-noticifications/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/09/wordpress-theme-developers-tip-theme-update-noticifications</feedburner:origLink></item>
		<item>
		<title>Summer Time Rush</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/49hkoifHS6s/summer-time-rush</link>
		<comments>http://clark-technet.com/2010/06/summer-time-rush#comments</comments>
		<pubDate>Wed, 23 Jun 2010 23:24:28 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[Aside]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=485</guid>
		<description><![CDATA[Summer time is a busy time for me at work and updates will be sparse but I will still be answering questions on the support forum. Please stay tuned for updates. If you&#8217;d like please subscribe to my RSS feed for updates. &#169;2012 Jeremy Clark - TechNet.com. All Rights Reserved..]]></description>
			<content:encoded><![CDATA[<p>Summer time is a busy time for me at work and updates will be sparse but I will still be answering questions on the support forum.  Please stay tuned for updates.  If you&#8217;d like please subscribe to my RSS feed for updates.</p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/Qt6uxUFr22ErmjvqNF_8nAGmu-E/0/da"><img src="http://feedads.g.doubleclick.net/~a/Qt6uxUFr22ErmjvqNF_8nAGmu-E/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Qt6uxUFr22ErmjvqNF_8nAGmu-E/1/da"><img src="http://feedads.g.doubleclick.net/~a/Qt6uxUFr22ErmjvqNF_8nAGmu-E/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=49hkoifHS6s:-UwjhgPRkYM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=49hkoifHS6s:-UwjhgPRkYM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=49hkoifHS6s:-UwjhgPRkYM:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=49hkoifHS6s:-UwjhgPRkYM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=49hkoifHS6s:-UwjhgPRkYM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=49hkoifHS6s:-UwjhgPRkYM:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/49hkoifHS6s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/06/summer-time-rush/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/06/summer-time-rush</feedburner:origLink></item>
		<item>
		<title>WordPress Theme Developers Tip – Automatic Feed Links in 3.0</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/5tbUv4-7G-U/wordpress-theme-developers-tip-automatic-feed-links-in-3-0</link>
		<comments>http://clark-technet.com/2010/05/wordpress-theme-developers-tip-automatic-feed-links-in-3-0#comments</comments>
		<pubDate>Thu, 20 May 2010 17:12:55 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=483</guid>
		<description><![CDATA[Version 3.0 of WordPress is due out soon, and theme developers are getting geared up to implement the new features. The new menu system has received much attention as it&#8217;s one of the biggest changes, besides the merge of the WPMU code, that most users will use. One feature that I didn&#8217;t know exists until [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.clark-technet.com/wp-content/uploads/2008/10/wordpresstip.jpg" alt="" title="WordPress" width="75" height="75" class="alignleft size-full wp-image-316" />Version 3.0 of WordPress is due out soon, and theme developers are getting geared up to implement the new features.  The new menu system has received much attention as it&#8217;s one of the biggest changes, besides the merge of the WPMU code, that most users will use.  </p>
<p>One feature that I didn&#8217;t know exists until now is automatic feed links which will output all the different feed links to current page the users is on to the header.  It was added in 2.8 but has been changed how it works for 3.0.  For example on a single post page the main blog feed, and the single post comment feed links are added to the header allowing a user to easily subscribe to the either feed.  Another is on a category archive page the feed for the main blog, as well as the feed for all posts in that category are added.  So I&#8217;ve got this feature added to my Techozoic theme but to maintain backwards compatibility I though I would share the simple function I came up with.<br />
<span id="more-483"></span><br />
To enable the automatic feed links it&#8217;s very simple, just use the add_theme_support function with the automatic-feed-links as the parameter like this into your functions.php.</p>
<pre class="brush: php; light: true; title: ; notranslate">
if(function_exists('add_theme_support')) {
	add_theme_support('automatic-feed-links');
	//WP Auto Feed Links
}
</pre>
<p>It&#8217;s critical to test if a function exists before calling it to prevent errors.</p>
<pre class="brush: php; title: ; notranslate">
function remove_feed_link(){
	global $wp_version;
	$default_feed_link = '&lt;link rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot; title=&quot;'. get_bloginfo('name'). ' RSS Feed&quot; href=&quot;'. get_bloginfo('rss2_url') .'&quot; /&gt;';
	if($wp_version &lt; 3){
		if(function_exists(automatic_feed_links)){
			$output .= automatic_feed_links();
		} else {
			$output .= $default_feed_link;
		}
	}
	echo $output;
}
	add_action('wp_head', 'remove_feed_link');
</pre>
<p>Most theme authors include the default RSS feed in the header of their themes, but the new feature requires those links to be removed to work correctly.  The trick to the automatic-feed-links is it&#8217;s a new 3.0 feature but the add_theme_support has exists since 2.9 so you can&#8217;t use the same check to disable your old feed links from the header.  But what you can do is to check if the check the wp_version variable is less than 3, and if it is use either automatic_feed_links function or echo your own RSS link.  Then you just add your function to be called with wp_head using add_action.</p>
<p>Futher Reference:<br />
<a href="http://codex.wordpress.org/Function_Reference/add_theme_support">add_theme_support Codex Article</a></p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/RP2CV_iyclUXB1pFUqC7dRX6OTQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/RP2CV_iyclUXB1pFUqC7dRX6OTQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/RP2CV_iyclUXB1pFUqC7dRX6OTQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/RP2CV_iyclUXB1pFUqC7dRX6OTQ/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=5tbUv4-7G-U:aQw5-PK6a3g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=5tbUv4-7G-U:aQw5-PK6a3g:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=5tbUv4-7G-U:aQw5-PK6a3g:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=5tbUv4-7G-U:aQw5-PK6a3g:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=5tbUv4-7G-U:aQw5-PK6a3g:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=5tbUv4-7G-U:aQw5-PK6a3g:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/5tbUv4-7G-U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/05/wordpress-theme-developers-tip-automatic-feed-links-in-3-0/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/05/wordpress-theme-developers-tip-automatic-feed-links-in-3-0</feedburner:origLink></item>
		<item>
		<title>HTC Incredible – Name That Fits</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/jOlsnNsWxRw/htc-incredible-name-that-fits</link>
		<comments>http://clark-technet.com/2010/05/htc-incredible-name-that-fits#comments</comments>
		<pubDate>Tue, 18 May 2010 16:32:15 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[google]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[HTC]]></category>
		<category><![CDATA[phone]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=476</guid>
		<description><![CDATA[I've recently traded my trusted Blackberry smartphone for an HTC Droid Incredible and I have to say the name truly fits this tiny powerhouse called a phone.  The biggest feature that I'm loving right now is an usable app store, if you've every used Blackberry's app world you'll know what a painful experience that can be.]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.clark-technet.com/wp-content/uploads/2010/05/htc-droid-incredible-2-300x386-116x150.jpg" alt="" title="htc-droid-incredible" width="116" height="150" class="alignleft size-thumbnail wp-image-477" />I&#8217;ve recently traded my trusted Blackberry 8330 smartphone for a HTC Droid Incredible and I have to say the name truly fits this tiny powerhouse called a phone.  The biggest feature that I&#8217;m loving right now is an usable app store, if you&#8217;ve every used Blackberry&#8217;s app world you&#8217;ll know what a painful experience that can be. </p>
<p>I&#8217;m also loving the camera, 8 megapixels is as same as my Canon DSLR.  Browsing the web is now a dream as well, the included browser even supports Flash albeit in a lite format.  Another handy feature is the speech recognition is very good and very well integrated into the built in Google search, allowing very quick searches via speaking rather than typing.  </p>
<p>Although I did have some doubts with the onscreen keyboard, I have fat fingers and always struggled to type on the tiny Blackberry keyboard, but the key recognition is spot on.  The predictive text is also very good and eases some of the typing.  Battery life can be a bit iffy for a full day of use, but as powerful as the phone is I&#8217;ll certainly trade having to charge it more often for the power.<span id="more-476"></span><br />
<div id="attachment_481" class="wp-caption aligncenter" style="width: 310px"><a href="http://static.clark-technet.com/wp-content/uploads/2010/05/clouds1.jpg"><img src="http://static.clark-technet.com/wp-content/uploads/2010/05/clouds1-300x179.jpg" alt="" title="Clouds" width="300" height="179" class="size-medium wp-image-481" /></a><p class="wp-caption-text">Photo Taken with HTC Incredible</p></div></p>
<h3>HTC Incredible Notable Specs</h3>
<ul>
<li>1Ghz Processor</li>
<li>512MB RAM</li>
<li>8GB Internal Memory/expandble to 40GB with 32GB microSD card</li>
<li>8 MegaPixel Camera with video</li>
<li>480 x 800 OLED Touchscreen</li>
<li>Android 2.1 with HTC Sense enhancements</li>
<li>WiFi</li>
<li>GPS Navigation</li>
<li>Speech Recoginition</li>
<li>Accelerometer</li>
</ul>
<p>If you have Verizon and in the market for a new smartphone I believe that the Incredible is the way to go.</p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/qEnuh5AoyyitsTGANEDpwjsYNIc/0/da"><img src="http://feedads.g.doubleclick.net/~a/qEnuh5AoyyitsTGANEDpwjsYNIc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/qEnuh5AoyyitsTGANEDpwjsYNIc/1/da"><img src="http://feedads.g.doubleclick.net/~a/qEnuh5AoyyitsTGANEDpwjsYNIc/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=jOlsnNsWxRw:4MuaAOV4WEE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=jOlsnNsWxRw:4MuaAOV4WEE:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=jOlsnNsWxRw:4MuaAOV4WEE:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=jOlsnNsWxRw:4MuaAOV4WEE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=jOlsnNsWxRw:4MuaAOV4WEE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=jOlsnNsWxRw:4MuaAOV4WEE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/jOlsnNsWxRw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/05/htc-incredible-name-that-fits/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/05/htc-incredible-name-that-fits</feedburner:origLink></item>
		<item>
		<title>Transfer to new hosting provider</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/MpjLCfS0Tv4/transfer-to-new-hosting-provider</link>
		<comments>http://clark-technet.com/2010/05/transfer-to-new-hosting-provider#comments</comments>
		<pubDate>Fri, 07 May 2010 19:21:02 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[Aside]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=470</guid>
		<description><![CDATA[Over the weekend I will be transitioning over to my new hosting provider, DreamHost. During this time this site will be down, sorry for any inconvenience. I will update this post after the transfer is complete. Update: Transfer complete, if you notice any problems please let me know. &#169;2012 Jeremy Clark - TechNet.com. All Rights [...]]]></description>
			<content:encoded><![CDATA[<p>Over the weekend I will be transitioning over to my new hosting provider, DreamHost.  During this time this site will be down, sorry for any inconvenience.  I will update this post after the transfer is complete.</p>
<p><strong>Update:</strong> Transfer complete, if you notice any problems please let me know.</p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/3WqUZUbOxLnpALCxrMjju9Ry8ag/0/da"><img src="http://feedads.g.doubleclick.net/~a/3WqUZUbOxLnpALCxrMjju9Ry8ag/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/3WqUZUbOxLnpALCxrMjju9Ry8ag/1/da"><img src="http://feedads.g.doubleclick.net/~a/3WqUZUbOxLnpALCxrMjju9Ry8ag/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=MpjLCfS0Tv4:aj3ViohV5Ao:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=MpjLCfS0Tv4:aj3ViohV5Ao:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=MpjLCfS0Tv4:aj3ViohV5Ao:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=MpjLCfS0Tv4:aj3ViohV5Ao:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=MpjLCfS0Tv4:aj3ViohV5Ao:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=MpjLCfS0Tv4:aj3ViohV5Ao:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/MpjLCfS0Tv4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/05/transfer-to-new-hosting-provider/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/05/transfer-to-new-hosting-provider</feedburner:origLink></item>
		<item>
		<title>Techozoic Fluid now on Google Code</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/Pb66m6_CWVw/techozoic-fluid-now-on-google-code</link>
		<comments>http://clark-technet.com/2010/04/techozoic-fluid-now-on-google-code#comments</comments>
		<pubDate>Fri, 23 Apr 2010 20:08:54 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[google]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=466</guid>
		<description><![CDATA[I've just setup proper project management for my <a href="http://code.google.com/p/techozoic-fluid/">Techozoic Fluid</a> theme using <a href="http://code.google.com/">Google Code</a>.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/p/techozoic-fluid/"><img src="http://static.clark-technet.com/wp-content/uploads/2010/04/techozoic-logo.png" alt="Techozoic Fluid Logo" title="Techozoic Fluid" width="100" height="100" class="alignleft size-full wp-image-467" /></a>I&#8217;ve just setup proper project management for my Techozoic Fluid theme using <a href="http://code.google.com/">Google Code</a>.  I have also designed a logo for my theme.  If you would like to always have the latest version of Techozoic you may now use <a href="http://subversion.apache.org/faq.html">Subversion</a> to checkout a copy.  If you are like me and keep up with the latest WordPress nightly releases then you&#8217;ll know how to checkout code using svn.  I use Linux but I&#8217;m sure svn works the same for Windows as well.</p>
<p>View the <a href="http://code.google.com/p/techozoic-fluid/">Techozoic Fluid</a> project page.</p>
<h3>Svn Checkout Instructions</h3>
<div style="margin-left:10px"><code>#cd /path/to/your/blog/wp-content/themes/<br />
#svn checkout http://techozoic-fluid.googlecode.com/svn/trunk/ techozoic-fluid<br />
</code>
</div>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/3JM0XAk7IncWh7-yUrd-uFsHAHI/0/da"><img src="http://feedads.g.doubleclick.net/~a/3JM0XAk7IncWh7-yUrd-uFsHAHI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/3JM0XAk7IncWh7-yUrd-uFsHAHI/1/da"><img src="http://feedads.g.doubleclick.net/~a/3JM0XAk7IncWh7-yUrd-uFsHAHI/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Pb66m6_CWVw:D2N_yVCiExA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Pb66m6_CWVw:D2N_yVCiExA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=Pb66m6_CWVw:D2N_yVCiExA:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Pb66m6_CWVw:D2N_yVCiExA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=Pb66m6_CWVw:D2N_yVCiExA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Pb66m6_CWVw:D2N_yVCiExA:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/Pb66m6_CWVw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/04/techozoic-fluid-now-on-google-code/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/04/techozoic-fluid-now-on-google-code</feedburner:origLink></item>
		<item>
		<title>WordPress Theme Developers Tip – Adding Theme Menu</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/Sh1tyJugqFI/wordpress-theme-developers-tip-adding-theme-menu</link>
		<comments>http://clark-technet.com/2010/03/wordpress-theme-developers-tip-adding-theme-menu#comments</comments>
		<pubDate>Fri, 26 Mar 2010 20:35:45 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=463</guid>
		<description><![CDATA[Sometimes a theme just outgrows having one menu page for theme options.  Instead of adding a second page a separate menu might be best.  Outlined are the steps and functions needed for this.  Code examples are also shown.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve already discussed how to add an <a href="http://clark-technet.com/2010/01/wordpress-theme-options-framework-ver-2">theme options page</a>.  Sometimes, as my theme has, a theme just outgrows having one menu page for everything.  Instead of adding a second page under the Appearance Menu a separate menu might be best.  The below code is an example of the functions required to use a separate menu.<br />
<span id="more-463"></span></p>
<pre class="brush: php; title: ; notranslate">
function mytheme_admin_page() {
	add_menu_page(&quot;Theme Options&quot;, &quot;Top Level Menu Name&quot;, 'edit_themes', 'menu_display_function','','',61);
	add_submenu_page('menu_display_function' ,&quot;Sub Page Title 1&quot;, &quot;Sub Page Menu Text&quot;, 'edit_themes', 'menu_display_function', 'sub_men_display_function');
	add_submenu_page('menu_display_function' ,&quot;Sub Page Title 2&quot;, &quot;Sub Page Menu Text 2&quot;, 'edit_themes', 'menu_display_function', 'sub_men_display_function_2');
}
menu_display_function(){
echo &quot;Top Level Menu Page&quot;;
}
sub_menu_display_function(){
echo &quot;Sub Page Level Page&quot;;
}
sub_menu_display_function_2(){
echo &quot;Sub Page Level Page 2&quot;;
}
add_action('admin_menu', 'mytheme_admin_page');
</pre>
<p>So what does this code do the add_menu_page function adds the top level container, this is like the Appearance, Plugins, Users &#8230; menu that already exist.</p>
<pre class="brush: php; light: true; title: ; notranslate">add_menu_page(page_title, menu_title, capability, handle, [function], [icon_url],menu_order);</pre>
<p>The parameters are </p>
<blockquote><p><strong>page_title</strong><br />
    Text that will go into the HTML page title for the page when the menu is active.<br />
<strong>menu_title</strong><br />
    The on-screen name text for the menu.<br />
<strong>capability</strong><br />
    The minimum capability required to display and use this menu page. Whilst for legacy reasons, you may also use user level â€“ the usage of user level is discouraged for future compatibility and has been deprecated since WordPress 1.5.<br />
<strong>handle/file</strong><br />
    If the function parameter is omitted, this should be the PHP file that handles the display of the menu page content. Otherwise, and more commonly, it will be a unique &#8220;handle&#8221; for the page. e.g. &#8220;my-awesome-plugin-settings&#8221;<br />
<strong>function</strong><br />
    The function that displays the page content for the menu page.<br />
<strong>icon_url</strong><br />
    The path to the icon for the menu, if not given default to a gear icon.<br />
<strong>menu_order</strong><br />
    A number for where the new menu should be inserted, defaults to below all other menus.  The 61 in the example code will place the menu right below the Appearance menu, which should work nicely for a theme admin menu.
</p></blockquote>
<p>To add the sub pages to the menu you call the add_submenu_page function.</p>
<pre class="brush: php; light: true; title: ; notranslate">add_submenu_page(parent, page_title, menu_title, capability required, file/handle, [function]);</pre>
<p>Parameters:</p>
<blockquote><p>
<strong>parent</strong><br />
    The filename of the core WordPress admin file that supplies the top-level menu in which you want to insert your submenu, or your plugin file if this submenu is going into a custom top-level menu.<br />
<strong>page_title</strong><br />
    Text that will go into the HTML page title for the page when the submenu is active.<br />
<strong>menu_title</strong><br />
    The on-screen name text for the submenu.<br />
<strong>capability</strong><br />
    The minimum capability required to display and use this menu page. Whilst for legacy reasons, you may also use user level the usage of user level is discouraged for future compatibility and has been deprecated since WordPress 1.5.<br />
file<br />
    For existing WordPress menus, the PHP file that handles the display of the menu page content. For submenus of a custom top-level menu, a unique identifier for this sub-menu page. </p>
<p>In situations where a plugin is creating its own top-level menu, the first submenu will normally have the same link title as the top-level menu and hence the link will be duplicated. The duplicate link title can be avoided by calling the add_submenu_page function the first time with the parent and file parameters being given the same value.</p>
<p><strong>function</strong><br />
    The function that displays the page content for the menu page. </p></blockquote>
<p>This is a very quick example of how this is done.  I will be updating my Theme Options Framework to include this as an option and to show how this is used in practice.  I&#8217;ve also done this for my <a href="http://http://wordpress.org/extend/themes/techozoic-fluid">Techozoic Fluid 1.8.6</a> theme which should be available soon.</p>
<p>Resources:
<ul>
<li><a href="http://codex.wordpress.org/Adding_Administration_Menus">Adding Administration Menus &#8211; WordPress Codex</a></li>
<li>
<a href="http://http://wpengineer.com/top-level-menu-in-wordpress-27/">Top Level Menu Page &#8211; WPEngineer</a></li>
</ul>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/J1xtkb4lx_HurexG21LxpCuzGRU/0/da"><img src="http://feedads.g.doubleclick.net/~a/J1xtkb4lx_HurexG21LxpCuzGRU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/J1xtkb4lx_HurexG21LxpCuzGRU/1/da"><img src="http://feedads.g.doubleclick.net/~a/J1xtkb4lx_HurexG21LxpCuzGRU/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Sh1tyJugqFI:6sZsN-VDeRY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Sh1tyJugqFI:6sZsN-VDeRY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=Sh1tyJugqFI:6sZsN-VDeRY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Sh1tyJugqFI:6sZsN-VDeRY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=Sh1tyJugqFI:6sZsN-VDeRY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Sh1tyJugqFI:6sZsN-VDeRY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/Sh1tyJugqFI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/03/wordpress-theme-developers-tip-adding-theme-menu/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/03/wordpress-theme-developers-tip-adding-theme-menu</feedburner:origLink></item>
		<item>
		<title>Server Migration – Part 2</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/Yu4hMiBg2as/server-migration-part-2</link>
		<comments>http://clark-technet.com/2010/02/server-migration-part-2#comments</comments>
		<pubDate>Thu, 11 Feb 2010 21:30:24 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=450</guid>
		<description><![CDATA[I&#8217;ve finished the server migration and everything was successful and only maybe 30-45 minutes of downtime. The old computer I&#8217;m using for a server got an upgrade while I was migrating as well. A little faster processor and doubled the memory in it. I did run into a problem with ESXi, apparently since the motherboard [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finished the server migration and everything was successful and only maybe 30-45 minutes of downtime.  The old computer I&#8217;m using for a server got an upgrade while I was migrating as well.  A little faster processor and doubled the memory in it.  </p>
<p>I did run into a problem with ESXi, apparently since the motherboard was older in the server ESXi wouldn&#8217;t install correctly onto the drive I had in there, and the motherboard also didn&#8217;t support booting from USB to install ESXi to a flash drive, as suggested by a few sites.  So I scraped the idea for ESXi and installed CentOS 5.4 on the server without any desktop managers and disabled everything except a few essential services, this netted a server using less than 200 MB of memory.  Then I installed VMWare Server 2 on it and transferred my VM image over to the server.  Although there is more overhead having a complete OS and VM Server for my purposes it should be fine.</p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/vJpxTZ4saDhmwlcYFByKbmcuJTY/0/da"><img src="http://feedads.g.doubleclick.net/~a/vJpxTZ4saDhmwlcYFByKbmcuJTY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/vJpxTZ4saDhmwlcYFByKbmcuJTY/1/da"><img src="http://feedads.g.doubleclick.net/~a/vJpxTZ4saDhmwlcYFByKbmcuJTY/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Yu4hMiBg2as:5AidtooQml8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Yu4hMiBg2as:5AidtooQml8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=Yu4hMiBg2as:5AidtooQml8:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Yu4hMiBg2as:5AidtooQml8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=Yu4hMiBg2as:5AidtooQml8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Yu4hMiBg2as:5AidtooQml8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/Yu4hMiBg2as" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/02/server-migration-part-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/02/server-migration-part-2</feedburner:origLink></item>
		<item>
		<title>Server Migration – Part 1</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/WJswyHiIwJc/server-migration-part-1</link>
		<comments>http://clark-technet.com/2010/02/server-migration-part-1#comments</comments>
		<pubDate>Thu, 04 Feb 2010 21:05:37 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=447</guid>
		<description><![CDATA[Before this week, my server that handles this website was beginning to show signs that it need a fresh start. It&#8217;s currently running CentOS 4.4, so I decided it&#8217;s time to upgrade. So I grabbed the latest DVD iso from CentOS for 5.4 and installed a clean virtual machine on my desktop. I&#8217;ve just finished [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.clark-technet.com/wp-content/uploads/2008/09/linux-logo.jpg" alt="" title="Tux" width="125" height="150" class="alignleft size-full wp-image-314" /><span class="alignright"><script type="text/javascript"><!--
google_ad_client = "pub-5880865034974171";
/* 125x125, created 3/13/08 */
google_ad_slot = "7590392760";
google_ad_width = 125;
google_ad_height = 125;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></span>Before this week, my server that handles this website was beginning to show signs that it need a fresh start.  It&#8217;s currently running CentOS 4.4, so I decided it&#8217;s time to upgrade.  So I grabbed the latest DVD iso from CentOS for 5.4 and installed a clean virtual machine on my desktop.  I&#8217;ve just finished migrating everything from the old server to the virtual machine.  I&#8217;ve also done away with the cobbled together mail solution of sendmail, dovecot, and assp I had running in favor of a very nice open-source Exchange-type replacement called <a href="http://www.zimbra.com">Zimbra</a>.  </p>
<p>The next step after a couple of days of testing will be wiping the old drive in the old server and installing VMWare ESXi on it.  I decided to virtualize to make it easier to upgrade in the future when I decide to build a new desktop.  I&#8217;ll retire my current desktop and recommission it as the new server and having everything virtualized should make the transition much smoother.  I&#8217;m hoping downtime will be minimal if any at all.</p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/h_9coKcDq-q2SUvy2ahT0gIfGs0/0/da"><img src="http://feedads.g.doubleclick.net/~a/h_9coKcDq-q2SUvy2ahT0gIfGs0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/h_9coKcDq-q2SUvy2ahT0gIfGs0/1/da"><img src="http://feedads.g.doubleclick.net/~a/h_9coKcDq-q2SUvy2ahT0gIfGs0/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=WJswyHiIwJc:4NVoL1Ca1pQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=WJswyHiIwJc:4NVoL1Ca1pQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=WJswyHiIwJc:4NVoL1Ca1pQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=WJswyHiIwJc:4NVoL1Ca1pQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=WJswyHiIwJc:4NVoL1Ca1pQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=WJswyHiIwJc:4NVoL1Ca1pQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/WJswyHiIwJc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/02/server-migration-part-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/02/server-migration-part-1</feedburner:origLink></item>
		<item>
		<title>WordPress Theme Developers Tip – Call Dynamic CSS the Right Way</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/9qeaRwQHfKU/wordpress-theme-developers-tip-call-dynamic-css-the-right-way</link>
		<comments>http://clark-technet.com/2010/01/wordpress-theme-developers-tip-call-dynamic-css-the-right-way#comments</comments>
		<pubDate>Mon, 25 Jan 2010 21:40:29 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[guides]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=446</guid>
		<description><![CDATA[While developing my Techozoic theme, I&#8217;ve progressed from adding custom CSS into the head section, to having an external file and using $_GET variables to pull options from the database, to now I believe is the right way to do it, using add_filter and a custom query in WordPress. By using this new method I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>While developing my Techozoic theme, I&#8217;ve progressed from adding custom CSS into the head section, to having an external file and using $_GET variables to pull options from the database, to now I believe is the right way to do it, using <a href="http://codex.wordpress.org/Function_Reference/add_filter">add_filter</a> and a custom query in WordPress.  By using this new method I&#8217;ve done away with unsafe $_GET variables and can now use any builtin WP functions in the external file.<br />
First you&#8217;ll need to edit your functions.php file and add this block of code.</p>
<pre class="brush: php; light: true; title: ; notranslate">
	add_filter('query_vars', 'add_new_var_to_wp');
	function add_new_var_to_wp($public_query_vars) {
		$public_query_vars[] = 'my_theme_custom_var';
		//my_theme_custom_var is the name of the custom query variable that is created and how you reference it in the call to the file
		return $public_query_vars;
	}
</pre>
<p>This sets up WP to now accept a new variable in a query called my_theme_custom_var the format of the query would be <code>http://www.yourblog.com/index.php?my_theme_custom_var=css</code> .  The ? mark tells WP that this is a query and the = sign tells what the query variable should be set to.</p>
<p>Now to actually setup the function that will call the external file.  I found this gem when looking at how popular WP theme called Atahualpa handled it&#8217;s external CSS.</p>
<pre class="brush: php; light: true; title: ; notranslate">
	add_action('template_redirect', 'my_theme_css_display');
	function my_theme_css_display(){
		$css = get_query_var('my_theme_custom_var');
		if ($css == 'css'){
			include_once (TEMPLATEPATH . '/style.php');
			exit;  //This stops WP from loading any further
		}
	}
</pre>
<p>This code now will check if a query is passed to WP with the value my_theme_custom_var and if it is and has the value of css then it includes the style.php file which is our dynamic CSS file.  Then the code exits which stops any other functions from happening other wise the whole home page is outputted along with the style.php file, which isn&#8217;t what is needed only the file.<br />
Now you can use any WP functions on the style.php file as it is included from the functions.php file which is a standard WP file.<br />
Source : <a href="http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files">Will Norris</a></p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/C3Dztv0b9F5scPUx2Pa9TxWwOzo/0/da"><img src="http://feedads.g.doubleclick.net/~a/C3Dztv0b9F5scPUx2Pa9TxWwOzo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/C3Dztv0b9F5scPUx2Pa9TxWwOzo/1/da"><img src="http://feedads.g.doubleclick.net/~a/C3Dztv0b9F5scPUx2Pa9TxWwOzo/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=9qeaRwQHfKU:CtR0K56bav8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=9qeaRwQHfKU:CtR0K56bav8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=9qeaRwQHfKU:CtR0K56bav8:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=9qeaRwQHfKU:CtR0K56bav8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=9qeaRwQHfKU:CtR0K56bav8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=9qeaRwQHfKU:CtR0K56bav8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/9qeaRwQHfKU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/01/wordpress-theme-developers-tip-call-dynamic-css-the-right-way/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/01/wordpress-theme-developers-tip-call-dynamic-css-the-right-way</feedburner:origLink></item>
		<item>
		<title>WordPress Theme Options Framework Ver 2</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/Dz0Nm7EfXPQ/wordpress-theme-options-framework-ver-2</link>
		<comments>http://clark-technet.com/2010/01/wordpress-theme-options-framework-ver-2#comments</comments>
		<pubDate>Tue, 12 Jan 2010 16:35:50 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[guides]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=444</guid>
		<description><![CDATA[An updated version of my Theme Options Framework rewritten for optimization.  Reduced the number of calls to database by reducing the number of entries added to database.  Also included a simple style.php file and header.php file to show how to use the options on an external file.]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.clark-technet.com/wp-content/uploads/2008/10/wordpresstip.jpg" alt="" title="WordPress" width="75" height="75" class="alignleft size-full wp-image-316" /><!-- WSA: ad in context small-square not shown: too many ads --> As I&#8217;ve worked more on my theme and increased my coding skills I&#8217;ve added to my <a href="http://clark-technet.com/2008/09/wordpress-theme-options-framework">original theme option framework</a>.  I&#8217;ve become more aware of best practices of coding and WordPress, a big issue with the original framework was the way options were added to the wp_options database table.  Each theme option got it&#8217;s own entry in the table, this might be okay for small theme, but I&#8217;ve grown to over 40 different options in my Techozoic theme.  It was time to optimize, with the new framework the entries added to the wp_options table went from 40 to 2.  I&#8217;ll continue below with code examples and explanations.  As an added bonus I&#8217;ve included an example of how to pull your theme options into a external stylesheet, based off of <a href="http://clark-technet.com/2009/09/wordpress-theme-dev-tip-dynamic-stylesheets">this concept</a>.</p>
<p><span class="alignright more"><span id="more-444"></span></span></p>
<p>Here is the updated framework files:</p>
<ul class="download alignleft">
<li class="aligncenter"><a href='http://static.clark-technet.com/wp-content/uploads/2010/01/theme_option_framework.zip'>Download</a></li>
</ul>
<p>
After you have the controlpanel.php file uploaded to your server into your theme&#8217;s main directory you&#8217;ll need to add this line to your functions.php file</p>
<pre class="brush: php; light: true; title: ; notranslate">&lt;?php require_once(TEMPLATEPATH . '/controlpanel.php'); ?&gt;</pre>
<p>Now you&#8217;ll need to start editing the array values to add your options.  The way you add options to the framework is still the same following the below templates.</p>
<pre class="brush: php; title: ; notranslate">
$options = array (
    array(  &quot;name&quot; =&gt; &quot;Radio Selection Set&quot;,
            &quot;desc&quot; =&gt; &quot;This is a descriptions&quot;,
            &quot;id&quot; =&gt; $shortname.&quot;_radio&quot;,
            &quot;type&quot; =&gt; &quot;radio&quot;,
            &quot;std&quot; =&gt; &quot;3&quot;,
            &quot;options&quot; =&gt; array(&quot;3&quot;, &quot;2&quot;, &quot;1&quot;)),

    array(  &quot;name&quot; =&gt; &quot;Text Box&quot;,
            &quot;desc&quot; =&gt; &quot;This is a descriptions&quot;,
            &quot;id&quot; =&gt; $shortname.&quot;_text_box&quot;,
            &quot;std&quot; =&gt; &quot;Some Default Text&quot;,
            &quot;type&quot; =&gt; &quot;text&quot;),

    array(  &quot;name&quot; =&gt; &quot;Bigger Text Box&quot;,
            &quot;desc&quot; =&gt; &quot;This is a descriptions&quot;,
            &quot;id&quot; =&gt; $shortname.&quot;_bigger_box&quot;,
            &quot;std&quot; =&gt; &quot;Default Text&quot;,
            &quot;type&quot; =&gt; &quot;textarea&quot;),

    array(  &quot;name&quot; =&gt; &quot;Dropdown Selection Menu&quot;,
            &quot;desc&quot; =&gt; &quot;This is a descriptions&quot;,
            &quot;id&quot; =&gt; $shortname.&quot;_dropdown_menu&quot;,
            &quot;type&quot; =&gt; &quot;select&quot;,
            &quot;std&quot; =&gt; &quot;Default&quot;,
            &quot;options&quot; =&gt; array(&quot;Default&quot;, &quot;Option 1&quot;, &quot;Option 2&quot;)),

    array(  &quot;name&quot; =&gt; &quot;Checkbox selection set&quot;,
            &quot;desc&quot; =&gt; &quot;This is a descriptions&quot;,
            &quot;id&quot; =&gt; $shortname.&quot;_checkbox_menu&quot;,
            &quot;type&quot; =&gt; &quot;checkbox&quot;,
            &quot;std&quot; =&gt; &quot;Default&quot;,
            &quot;options&quot; =&gt; array(&quot;Default&quot;, &quot;Option 1&quot;, &quot;Option 2&quot;)),

    array(  &quot;name&quot; =&gt; &quot;Multiple selection box&quot;,
            &quot;desc&quot; =&gt; &quot;This is a descriptions&quot;,
            &quot;id&quot; =&gt; $shortname.&quot;_multi_select_dropdown_menu&quot;,
            &quot;type&quot; =&gt; &quot;multiselect&quot;,
            &quot;std&quot; =&gt; &quot;Default&quot;,
            &quot;options&quot; =&gt; array(&quot;Defaults&quot;, &quot;Option 1s&quot;, &quot;Option 2s&quot;))
);
</pre>
<p>Another new feature I&#8217;ve added is a theme init script.  It&#8217;s useful for adding default values to the wp_options table.  This code will also pull values already in separate wp_options entries and put them into the single array wp_option, then delete the old entries.  Then the code sets a separate value in the wp_options table as a check so the script will only run if it doesn&#8217;t find that value.  Then the function is added to the dashboard and main page header via the action hook.  So the first time any visits a page in the dashboard or on the blog the mytheme_add_options will run, but only the first time.</p>
<pre class="brush: php; title: ; notranslate">
function mytheme_add_options() {
global $themename, $shortname, $options;
foreach ($options as $value) {
	$key = $value['id'];
	$val = $value['std'];
		if( $existing = get_option($key)){
			$new_options[$key] = $existing;
			delete_option($key);
		} else {
			$new_options[$key] = $val;
			delete_option($key);
		}
}
add_option($shortname.'_options', $new_options );
}

function first_run_options() {
global $shortname;
$check = get_option($shortname.'_activation_check');
	if ( $check != &quot;set&quot; ) {
		mytheme_add_options();
   		add_option($shortname.'_activation_check', &quot;set&quot;);
  	}
}
add_action('wp_head', 'first_run_options');
add_action('admin_head', 'first_run_options');
</pre>
<p>After you have your option page the way you like you&#8217;ll need some way of get the variables onto other pages of you theme.  You&#8217;ll need to add these next few lines to every page on which you plan to use the theme variables.  Then the variables will be called like an array with the key being the option id.</p>
<pre class="brush: php; light: true; title: ; notranslate">
&lt;?php
global $shortname;
$settings = get_option($shortname.'_options');
// Options are called like this $settings['option_id'];
?&gt;
</pre>
<p>Now you can use the variables on this page.  The variables will look like this let&#8217;s assume you set $shortname = &#8220;theme&#8221;, then your variables will look like this $theme_radio, $theme_text_box, $theme_bigger_box, $theme_dropdown_menu.  Also keep in mind that you can add one than one of any kind of element, you can also rename any of the elements for easier variable management.  Where &#8220;id&#8221; => $shortname.&#8221;_radio&#8221;, is defined you can change the _radio part to reflect what the option is actually for. To check the value of your multiple selection or checkbox variables you&#8217;ll need to use this.  Where Item is the value that your checking that is selected or checked.</p>
<pre class="brush: php; light: true; title: ; notranslate">
&lt;?php
if(in_array(&quot;Item&quot;,$settings['theme_checkbox']));
?&gt;
</pre>
<p>Now I&#8217;ll show how to use your theme options on an external stylesheet rather than placing them in the head of the theme, which is bad web practice.  It also has the added benefit of the page being cached by the browser so it will also save on bandwidth.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
global $options, $shortname;
$settings = get_option($shortname.'_options');
//Options will be called like this $settings['shortname_option_name']
&lt;head&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;&lt;?php bloginfo('home') ?&gt;/?css=css&quot;/&gt;

&lt;?php
if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
wp_head(); ?&gt;
&lt;/head&gt;
</pre>
<p>This code uses something called a query variable that is registered in the functions.php file like shown below to call the style.php file and allow it to use WordPress builtin functions for calling options.  Much cleaner and safer than the $_GET method I used earlier.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

	function add_new_var_to_wp($public_query_vars) {

		$public_query_vars[] = 'css';

		return $public_query_vars;

	}

	function dynamic_css_display(){

		$css = get_query_var('css');

		if ($css == 'css'){

			include_once (TEMPLATEPATH . '/style.php');

			exit;

		}

	}

	add_filter('query_vars', 'add_new_var_to_wp');

	add_action('template_redirect', 'dynamic_css_display');

?&gt;
</pre>
<p>This registers the query variable called css and if that variable is set to css as it is when the stylesheet is called in the header with the ?css=css appended to the end then the style.php file is included then the everything else is stopped with the exit in the code.  </p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
global $shortname;
header('Content-type: text/css');
header(&quot;Cache-Control: must-revalidate&quot;);
$offset = 72000 ;
$ExpStr = &quot;Expires: &quot; . gmdate(&quot;D, d M Y H:i:s&quot;, time() + $offset) . &quot; GMT&quot;;
header($ExpStr);
$settings = get_option($shortname.'_options');
// Variables should be added with {} brackets
echo &lt;&lt;&lt;CSS
/*Style Sheet Start*/
body {
background-color: {$settings['theme_option_color']};
}
CSS;
//More php can go here
echo &lt;&lt;&lt;CSS
/*Style Sheet End*/
CSS;
?&gt;
</pre>
<p>The style.php file can now use the WordPress function get_option for retrieving options from the database.  Once this is done then the option variables will be called as an array with the option id being the key ie: $settings['theme_option_color']</p>
<h3> Update </h3>
<p>I&#8217;ve had a request for adding an upload form to the options page for adding a custom header image.  I&#8217;ve done this same thing in my Techozoic theme, if you would like to look at it to see a practical use of it you can download it <a href="http://wordpress.org/extend/themes/techozoic-fluid">here</a>.  Basically you&#8217;ll need to add a separate file to process the uploaded files, and the form to upload the files.  An example upload file can be downloaded <a href='http://static.clark-technet.com/wp-content/uploads/2010/01/upload.zip'>here</a>.  Then the form can be added to the options page with this code.</p>
<pre class="brush: php; light: true; title: ; notranslate">
&lt;form enctype=&quot;multipart/form-data&quot; encoding=&quot;multipart/form-data&quot; action=&quot;&lt;?php bloginfo('template_directory') ?&gt;/upload.php&quot; method=&quot;post&quot;&gt;
&lt;input type=&quot;file&quot; name=&quot;file&quot; /&gt;&lt;br /&gt;
&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Upload&quot; /&gt;
&lt;/form&gt;
</pre>
<p>You just need to upload the file and make sure it&#8217;s in the root of your theme directory and named upload.php.  You can also edit the upload.php file to change the restrictions on file size and file type.  I&#8217;ve set the upload.php file to only accept jpg, gif, and png files under 1 MB which should be fine for uploading header images.</p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/R8sk00tj5J2PG9hW0sNvs-BaXLs/0/da"><img src="http://feedads.g.doubleclick.net/~a/R8sk00tj5J2PG9hW0sNvs-BaXLs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/R8sk00tj5J2PG9hW0sNvs-BaXLs/1/da"><img src="http://feedads.g.doubleclick.net/~a/R8sk00tj5J2PG9hW0sNvs-BaXLs/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Dz0Nm7EfXPQ:DuAvn1hzyh8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Dz0Nm7EfXPQ:DuAvn1hzyh8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=Dz0Nm7EfXPQ:DuAvn1hzyh8:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Dz0Nm7EfXPQ:DuAvn1hzyh8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=Dz0Nm7EfXPQ:DuAvn1hzyh8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Dz0Nm7EfXPQ:DuAvn1hzyh8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/Dz0Nm7EfXPQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2010/01/wordpress-theme-options-framework-ver-2/feed</wfw:commentRss>
		<slash:comments>45</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2010/01/wordpress-theme-options-framework-ver-2</feedburner:origLink></item>
		<item>
		<title>Ubuntu 9.10 Released</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/Q9xNuXJICT0/ubuntu-9-10-released</link>
		<comments>http://clark-technet.com/2009/10/ubuntu-9-10-released#comments</comments>
		<pubDate>Thu, 29 Oct 2009 20:03:50 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[9.10]]></category>
		<category><![CDATA[os]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=442</guid>
		<description><![CDATA[Ubuntu, Canonical flagship Linux OS is now in version 9.10 which released 10/29/2009.  New features are included for both the Desktop and Server versions.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ubuntu.com/products/whatisubuntu"><img src="http://static.clark-technet.com/wp-content/uploads/2008/03/ubuntulogo.jpg" alt="ubuntulogo" title="ubuntulogo" width="150" height="41" class="alignleft size-full wp-image-240" /></a> Ubuntu the Linux distro from Canonical has released a new version 9.10.  The biggest new features are Firefox 3.5 and access to &#8220;<a href="https://one.ubuntu.com/">Ubuntu One</a>&#8220;, online storage space.  Every user gets 2GB of free space for backup and sharing.  Of course access to thousands of applications and games is available through the software center as well.  This release was focused on beautification of the desktop rather than major feature inclusion.  </p>
<p>The server edition wasn&#8217;t overlooked though, it now includes <a href="http://www.ubuntu.com/cloud/private">Ubuntu Enterprise Cloud</a>.  Organizations that use Ubuntu Server can now take advantage of <a href="http://en.wikipedia.org/wiki/Cloud_computing">cloud computing</a>.</p>
<ul>
<li><a href="http://www.ubuntu.com/products/whatisubuntu/910features/">Ubuntu Desktop</a></li>
<li><a href="http://www.ubuntu.com/news/ubuntu-910-server-edition">Ubuntu Server</a></li>
</ul>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/UdboX5UDGEIkrVJX2Dep3zqhxeg/0/da"><img src="http://feedads.g.doubleclick.net/~a/UdboX5UDGEIkrVJX2Dep3zqhxeg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/UdboX5UDGEIkrVJX2Dep3zqhxeg/1/da"><img src="http://feedads.g.doubleclick.net/~a/UdboX5UDGEIkrVJX2Dep3zqhxeg/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Q9xNuXJICT0:ObWR3zS6VIw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Q9xNuXJICT0:ObWR3zS6VIw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=Q9xNuXJICT0:ObWR3zS6VIw:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Q9xNuXJICT0:ObWR3zS6VIw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=Q9xNuXJICT0:ObWR3zS6VIw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=Q9xNuXJICT0:ObWR3zS6VIw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/Q9xNuXJICT0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2009/10/ubuntu-9-10-released/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2009/10/ubuntu-9-10-released</feedburner:origLink></item>
		<item>
		<title>WordPress, Caching, and Compression</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/-_k1CmZKZzQ/wordpress-caching-and-compression</link>
		<comments>http://clark-technet.com/2009/10/wordpress-caching-and-compression#comments</comments>
		<pubDate>Tue, 27 Oct 2009 20:09:52 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=440</guid>
		<description><![CDATA[After reading an interesting article dealing with optimizing your WordPress blog I decided to optimize mine.  I detail how I cut page load times in half by simply enabling caching and compression in an Apache web server.]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.clark-technet.com/wp-content/uploads/2009/10/apache.jpg" alt="Apache" title="Apache" width="100" height="76" class="alignleft size-full wp-image-441" />After reading this <a href="http://sewmyheadon.com/2009/5-free-ways-to-bulletproof-your-wordpress-site/">article</a> dealing with &#8220;bulletproofing&#8221; a blog, I started looking at my own blog.  Over the past few months as more and more great plugins come out that I depend on now, my page load times had started suffering.  A load time of 14 seconds on a T1 was not unheard of, and it could get as bad as 20 seconds on some days.  The article by Eric Amundson had a <a href="http://sewmyheadon.com/2009/5-free-ways-to-bulletproof-your-wordpress-site/#wcsea3">link</a> to a couple of Firefox plugins that looked promising in helping diagnose ailing websites.  One is <a href="http://code.google.com/speed/page-speed/">Page Speed</a> from Google.  The other from Yahoo! called <a href="http://addons.mozilla.org/en-US/firefox/addon/5369">YSlow</a>.</p>
<p><span id="more-440"></span></p>
<p>After downloading both of these and running them against my blog both were suggesting what I thought at the time would be a major project, enabling <a href="http://httpd.apache.org/docs/2.2/caching.html">caching</a> and <a href="http://httpd.apache.org/docs/2.2/mod/mod_deflate.html">gzip compression</a> on my server.  To enable caching I found this <a href="http://www.askapache.com/htaccess/speed-up-your-site-with-caching-and-cache-control.html">site</a> that had great examples of a simple addition to the .htaccess file in the blog directory would enable caching.  The only thing needing to be edited in Apache is making sure that mod_cache and mod_expires modules are loaded.  Most standard installations will already have these loaded for you.  </p>
<p>After this I started working on enabling compression.  I again found another good resource on how to do that <a href="http://www.techiegyan.com/?p=251">here</a>.  I left out the section of mod_expires since I had a .htaccess file with that code already.  After doing this and a few other minor adjustments, my page load times were cut in half.  On average 7-8 seconds for a first time visit and under 2 seconds for opening a post or another page thanks to most elements already being cached.</p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/eI4XmOmhaLRJUtiuWf3EnXnpXJs/0/da"><img src="http://feedads.g.doubleclick.net/~a/eI4XmOmhaLRJUtiuWf3EnXnpXJs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/eI4XmOmhaLRJUtiuWf3EnXnpXJs/1/da"><img src="http://feedads.g.doubleclick.net/~a/eI4XmOmhaLRJUtiuWf3EnXnpXJs/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=-_k1CmZKZzQ:f1-CYAbkjJM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=-_k1CmZKZzQ:f1-CYAbkjJM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=-_k1CmZKZzQ:f1-CYAbkjJM:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=-_k1CmZKZzQ:f1-CYAbkjJM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=-_k1CmZKZzQ:f1-CYAbkjJM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=-_k1CmZKZzQ:f1-CYAbkjJM:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/-_k1CmZKZzQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2009/10/wordpress-caching-and-compression/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2009/10/wordpress-caching-and-compression</feedburner:origLink></item>
		<item>
		<title>Comment Problem Fixed</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/RfI7bnu6btg/comment-problem-fixed</link>
		<comments>http://clark-technet.com/2009/10/comment-problem-fixed#comments</comments>
		<pubDate>Tue, 06 Oct 2009 14:04:50 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[Aside]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=439</guid>
		<description><![CDATA[If anyone has tried to comment and couldn&#8217;t the problem is now fixed. While cleaning my database I accidentally deleted a needed field in the comment table. No big deal I readded it and now up and going again. So if you had a question or comment you should be able to post it now. [...]]]></description>
			<content:encoded><![CDATA[<p>If anyone has tried to comment and couldn&#8217;t the problem is now fixed.  While cleaning my database I accidentally deleted a needed field in the comment table.  No big deal I readded it and now up and going again.  So if you had a question or comment you should be able to post it now.  Sorry for any inconvience.</p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/4rvGrVE88GtZNESM8UsOk2HIgbI/0/da"><img src="http://feedads.g.doubleclick.net/~a/4rvGrVE88GtZNESM8UsOk2HIgbI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/4rvGrVE88GtZNESM8UsOk2HIgbI/1/da"><img src="http://feedads.g.doubleclick.net/~a/4rvGrVE88GtZNESM8UsOk2HIgbI/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=RfI7bnu6btg:l1aZNUbPGLQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=RfI7bnu6btg:l1aZNUbPGLQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=RfI7bnu6btg:l1aZNUbPGLQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=RfI7bnu6btg:l1aZNUbPGLQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=RfI7bnu6btg:l1aZNUbPGLQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=RfI7bnu6btg:l1aZNUbPGLQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/RfI7bnu6btg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2009/10/comment-problem-fixed/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2009/10/comment-problem-fixed</feedburner:origLink></item>
		<item>
		<title>WordPress Theme Dev Tip – Dynamic Stylesheets</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/PEcLQqAVXzc/wordpress-theme-dev-tip-dynamic-stylesheets</link>
		<comments>http://clark-technet.com/2009/09/wordpress-theme-dev-tip-dynamic-stylesheets#comments</comments>
		<pubDate>Fri, 18 Sep 2009 20:32:51 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Techozoic]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=436</guid>
		<description><![CDATA[A dynamic stylesheet using php is a powerful thing, when accompanied by a user options page it can really make a theme.  I've recently done this to my Techozoic theme, and I'm going to share how this works and some time saving tips.]]></description>
			<content:encoded><![CDATA[<p><a href="http://static.clark-technet.com/wp-content/uploads/2008/10/wordpresstip.jpg"><img src="http://static.clark-technet.com/wp-content/uploads/2008/10/wordpresstip.jpg" alt="WordPress" title="WordPress" width="75" height="75" class="alignleft size-full wp-image-316" /></a>A <a href="http://clark-technet.com/2009/09/dynamic-stylesheets-using-php">dynamic stylesheet</a> using php is a powerful thing, when accompanied by a user options page it can really make a theme.  I&#8217;ve recently done this to my <a href="http://wordpress.org/extend/themes/techozoic-fluid">Techozoic</a> theme, and I&#8217;m going to share how this works and some time saving tips.</p>
<p>First you&#8217;ll want some way of letting the theme user choose what will change in the stylesheet, I explain how to do this with a theme options framework<a href="http://clark-technet.com/2008/09/wordpress-theme-options-framework"> here</a>.  After you&#8217;ve got all the options set the way you want you need some way of getting those into your theme.  At first I was just using <code>&lt;style&gt;&lt;/style&gt;</code> tags in the header of the theme, while this works it just isn&#8217;t an efficient way of writing a theme.  What I wanted to do was have an external file that changed with the options but that could also be cached by the web browser, to improve performance, save bandwidth and overall have a better written theme.</p>
<p>Now if your using a framework similar to mine or your using mine then you know you have to pull some info from the WordPress database to fill in your variables from your option page.  This posed the biggest problem because since this was an external page none of the WordPress functions would work.  To get around this in the first version I just loaded the wp-config.php and wp-load.php files in the top of the file.  This is bad practice because WordPress site owners can move these files around now and there is now way to know where to load these from.  So I spotted the solution from another theme developer.  Making an array of all the option values then using php GET variable on the external stylesheet.  Now onto the actual code.</p>
<p><span class="alignright more"><span id="more-436"></span></span></p>
<p>First this is the code that my framework uses to pull the options from the WordPress database.</p>
<pre class="brush: php; light: true; title: ; notranslate">
&lt;?php
global $options;
foreach ($options as $value) {
	if($value['type']!=&quot;checkbox&quot; and $value['type']!=&quot;multiselect&quot;){
		if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else {
		$$value['id'] = get_settings( $value['id'] ); }
	}else{
		if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = explode(&quot;,&quot;,$value['std']); } else {
		$$value['id'] = explode(&quot;,&quot;,get_settings( $value['id'] )); }
	}
} ?&gt;
</pre>
<p>I just modified it to add all the values to another variable seperated by a |.</p>
<pre class="brush: php; light: true; title: ; notranslate">
&lt;?php
global $options;
foreach ($options as $value) {
	if($value['type']!=&quot;checkbox&quot; and $value['type']!=&quot;multiselect&quot;){
		if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else {
		$$value['id'] = get_settings( $value['id'] ); }
	}else{
		if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = explode(&quot;,&quot;,$value['std']); } else {
		$$value['id'] = explode(&quot;,&quot;,get_settings( $value['id'] )); }
	}
$css .= $$value['id'].&quot;|&quot;; }
$css = urlencode($css);
?&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;&lt;?php bloginfo('template_directory') ?&gt;/style.php?css=&lt;?php echo $css;?&gt;&quot;/&gt;
</pre>
<p>So now the variable $css now holds all the values of the options set by the theme user.  Then for the external stylesheet it should be named whatever you like except instead of a .css extension give it a .php extension so the php processing engine of the web server will know it has php in it.  Then the link tag gives the path to the style.php file but also notice it appends the<code>?css=&lt;?php echo $css;?&gt;</code> this actually sends all the options to the dynamic stylesheet called style.php.  Then you&#8217;ll just need to add this to the top of the style.php file.</p>
<pre class="brush: php; light: true; title: ; notranslate">
&lt;?php
header('Content-type: text/css');
header(&quot;Cache-Control: must-revalidate&quot;);
$offset = 72000 ;
$ExpStr = &quot;Expires: &quot; . gmdate(&quot;D, d M Y H:i:s&quot;, time() + $offset) . &quot; GMT&quot;;
header($ExpStr);
$css = $_GET[&quot;css&quot;];
$css = urldecode($css);
$s = explode(&quot;|&quot;, $css);
</pre>
<p>This tells the web browser to process the output of this file as plain text and use a stylesheet instructions.  This also sets up the caching that was important to me.  Then it gets the value of $css which was passed to the style.php file when it was called in the header.php of the theme.  After that it decodes it and then <a href="http://us3.php.net/explode">explodes</a> it into an <a href="http://us3.php.net/manual/en/language.types.array.php">array</a>.  Now to access your option values you&#8217;ll just use variables like this.</p>
<pre class="brush: php; light: true; title: ; notranslate">
$s[0]
$s[1]
</pre>
<p>It&#8217;s important to know the order your options will be added to the array so you can call the right value when needed, also keep in mind that arrays start at 0 so the first value will not be 1.  For an example you can download my <a href="http://wordpress.org/extend/themes/techozoic-fluid">Techozoic</a> theme and look in the controlpanel.php for the options framework then in the header.php for the code to pull the options into the array then in the style.php file itself to see how to use the variables in the stylesheet.  In my theme however since I already had most of the variables already named I just assigned the value of the array to the different variables I already had setup.  It makes it easier in the long run I think because you can give more descriptive names to make everything more readable and easier to understand.</p>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/yDZcnEd2ZtSzYkx8GMduvkcGqxY/0/da"><img src="http://feedads.g.doubleclick.net/~a/yDZcnEd2ZtSzYkx8GMduvkcGqxY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/yDZcnEd2ZtSzYkx8GMduvkcGqxY/1/da"><img src="http://feedads.g.doubleclick.net/~a/yDZcnEd2ZtSzYkx8GMduvkcGqxY/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=PEcLQqAVXzc:B7JMgne6uf0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=PEcLQqAVXzc:B7JMgne6uf0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=PEcLQqAVXzc:B7JMgne6uf0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=PEcLQqAVXzc:B7JMgne6uf0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=PEcLQqAVXzc:B7JMgne6uf0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=PEcLQqAVXzc:B7JMgne6uf0:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/PEcLQqAVXzc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2009/09/wordpress-theme-dev-tip-dynamic-stylesheets/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2009/09/wordpress-theme-dev-tip-dynamic-stylesheets</feedburner:origLink></item>
		<item>
		<title>Dynamic Stylesheets using PHP</title>
		<link>http://feedproxy.google.com/~r/clark-technet/bRdG/~3/RAupqd0XYRA/dynamic-stylesheets-using-php</link>
		<comments>http://clark-technet.com/2009/09/dynamic-stylesheets-using-php#comments</comments>
		<pubDate>Thu, 17 Sep 2009 15:41:33 +0000</pubDate>
		<dc:creator>Jeremy Clark</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://clark-technet.com/?p=437</guid>
		<description><![CDATA[Recently while doing some work on my theme for WordPress I came across a very helpful idea.  Using PHP in a stylesheet to make it more dynamic.  The basic idea is to use PHP variables and define certain elements that repeat in various places such as a color code to make it easily changeable by only having to change one line instead of searching for and replacing multiple times.  Other examples are fonts, images, widths, even whole sections of code could be shown or hidden with the use of variables and an if statement.]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.clark-technet.com/wp-content/uploads/2008/10/css1.jpg" alt="CSS" title="CSS" width="100" height="100" class="alignleft size-full wp-image-320" /><!-- WSA: ad in context small-square not shown: too many ads -->Recently while doing some work on my <a href="http://wordpress.org/extend/themes/techozoic-fluid">theme</a> for WordPress I came across a very helpful idea.  Using PHP in a stylesheet to make it more dynamic.  The basic idea is to use PHP <a href="http://us3.php.net/language.variables">variables</a> and define certain elements that repeat in various places such as a color code to make it easily changeable by only having to change one line instead of searching for and replacing multiple times.  Other examples are fonts, images, widths, even whole sections of code could be shown or hidden with the use of variables and an <a href="http://us3.php.net/manual/en/control-structures.if.php">if statement</a>.</p>
<p><span class="alignright"><span id="more-437"></span></span></p>
<p>The first difference with using PHP in a stylesheet is the extension of the file has to change, from .css to .php for the web server to know how to process the PHP language in the file.  Then since the file is now a php file it wont be cached by web browsers and will be reloaded every page view which is unnecessary, but there is a way to fix that.  I&#8217;ll now show a very simple dynamic stylesheet then explain each part individually.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
header('Content-type: text/css');
header(&quot;Cache-Control: must-revalidate&quot;);
$offset = 72000 ;
$ExpStr = &quot;Expires: &quot; . gmdate(&quot;D, d M Y H:i:s&quot;, time() + $offset) . &quot; GMT&quot;;
header($ExpStr);

$bg_color = &quot;#FFFF00&quot;;
$body_font = &quot;Tahoma&quot;;
$link_color = &quot;#0000FF&quot;;
$alt_color = &quot;1&quot;;

echo &lt;&lt;&lt;CSS
body {
background-color: {$bg_color};
font-family:{$body_font};
}
a {
color: {$link_color};
}
CSS;

if ($alt_color = 1) {
echo &lt;&lt;&lt;CSS
body {
background-color: #FFFFFF;
}
CSS;
} // Closing If tag
?&gt;
</pre>
<p>Lines 1-6 setup the headers of the file to allow for browser caching, the will reduce bandwidth usage and save on some server processing.  </p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
header('Content-type: text/css');
header(&quot;Cache-Control: must-revalidate&quot;);
$offset = 72000 ;
$ExpStr = &quot;Expires: &quot; . gmdate(&quot;D, d M Y H:i:s&quot;, time() + $offset) . &quot; GMT&quot;;
header($ExpStr);
</pre>
<p>Next 8-11 then set up the variables that will be used through the rest of the stylesheet.  Notice that everything is enclosed in quotation marks, if for some reason you need to include quotation marks in the variable then you must <a href="http://us3.php.net/manual/en/language.types.string.php">escape</a> it by adding a slash in front of the mark like this \&#8221; .</p>
<pre class="brush: php; first-line: 8; title: ; notranslate">
$bg_color = &quot;#FFFF00&quot;;
$body_font = &quot;Tahoma&quot;;
$link_color = &quot;#0000FF&quot;;
$alt_color = &quot;1&quot;;
</pre>
<p>On lines 13- 21 the actual styles are <a href="http://us3.php.net/manual/en/function.echo.php">echoed</a> which will print it to the text of the file, but the good thing about having the php is that you can mix in your variables when echoing.  Notice the <code>echo &lt;&lt;&lt;CSS</code> this tells php to output text until it sees CSS again which is on line 21.  Then you also see the <code>{$bg_color}</code>, this is the way to use your variables the {} tell it that it&#8217;s a php variable and to output it&#8217;s value instead of the actual text $bg_color.</p>
<pre class="brush: php; first-line: 13; title: ; notranslate">
echo &lt;&lt;&lt;CSS
body {
background-color: {$bg_color};
font-family:{$body_font};
}
a {
color: {$link_color};
}
CSS;
</pre>
<p>Finally on lines 23-30 is a simple if statement checking the value of the $alt_color and if it equals 1 then to add lines 24-28 to the output as well.  Then you&#8217;ll see the closing <code>?&gt;</code> tag which says to stop processing the file.</p>
<pre class="brush: php; first-line: 23; title: ; notranslate">
if ($alt_color = 1) {
echo &lt;&lt;&lt;CSS
body {
background-color: #FFFFFF;
}
CSS;
} // Closing If tag
?&gt;
</pre>
<p>Other Resources:</p>
<ul>
<li><a href="http://us3.php.net/docs.php">PHP Documentation</a></li>
<li><a href="http://www.w3schools.com/php/default.asp">W3Schools PHP tutorials</a></li>
<li><a href="http://www.w3schools.com/css/default.asp">W3Schools CSS tutorials</a></li>
<li><a href="http://www.digital-web.com/articles/generating_dynamic_css_with_php/">Digital Web Magazine Article</a></li>
</ul>
<p>&copy;2012 <a href="http://clark-technet.com">Jeremy Clark - TechNet.com</a>. All Rights Reserved.</p>.
<p><a href="http://feedads.g.doubleclick.net/~a/fOPWj2n3lnvnugJRUbVYYiL_2po/0/da"><img src="http://feedads.g.doubleclick.net/~a/fOPWj2n3lnvnugJRUbVYYiL_2po/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/fOPWj2n3lnvnugJRUbVYYiL_2po/1/da"><img src="http://feedads.g.doubleclick.net/~a/fOPWj2n3lnvnugJRUbVYYiL_2po/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=RAupqd0XYRA:NzvJ21_gCdw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=RAupqd0XYRA:NzvJ21_gCdw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=RAupqd0XYRA:NzvJ21_gCdw:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=RAupqd0XYRA:NzvJ21_gCdw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?i=RAupqd0XYRA:NzvJ21_gCdw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/clark-technet/bRdG?a=RAupqd0XYRA:NzvJ21_gCdw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/clark-technet/bRdG?d=7Q72WNTAKBA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/clark-technet/bRdG/~4/RAupqd0XYRA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://clark-technet.com/2009/09/dynamic-stylesheets-using-php/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://clark-technet.com/2009/09/dynamic-stylesheets-using-php</feedburner:origLink></item>
	</channel>
</rss><!-- Served from: clark-technet.com @ 2012-02-09 15:15:22 by W3 Total Cache -->

