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

<channel>
	<title>Press Coders</title>
	<atom:link href="http://www.presscoders.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.presscoders.com</link>
	<description>WordPress Themes &#38; Plugin Development</description>
	<lastBuildDate>Fri, 03 Feb 2012 17:01:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Full Service Theme Hosting</title>
		<link>http://www.presscoders.com/2012/02/full-service-theme-hosting/</link>
		<comments>http://www.presscoders.com/2012/02/full-service-theme-hosting/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 17:15:59 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://www.presscoders.com/?p=3988</guid>
		<description><![CDATA[Press Coders is now offering full service, all inclusive WordPress hosting to our theme customers. We&#8217;ve been referring our customers to outside hosts for a while now, but we find that we answer a lot of questions about how to set everything up. Sometimes it will be weeks from the time someone buys their hosting [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.presscoders.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/3988.png&amp;w=200&amp;h=150&amp;zc=1&amp;ft=png' alt='post thumbnail' /></p>
<p><img src="http://www.presscoders.com/wp-content/uploads/2012/01/hosting-thumb.png" alt="WordPress Theme Hosting" title="WordPress Theme Hosting" width="230" height="167" class="alignleft size-full wp-image-3992 noborder" /></p>
<p><strong>Press Coders is now offering full service, all inclusive <a href="http://www.presscoders.com/hosting">WordPress hosting</a> to our theme customers.</strong></p>
<p>We&#8217;ve been referring our customers to outside hosts for a while now, but we find that we answer a lot of questions about how to set everything up. Sometimes it will be weeks from the time someone buys their hosting until they actually get their site online.</p>
<p>If you setup hosting yourself, you have to find a hosting company you trust, purchase a plan, register a domain, connect the domain and hosting, install WordPress, install your theme, then build your site. That&#8217;s assuming you already know how to do that stuff and you don&#8217;t need help.</p>
<p><strong>What a pain!</strong></p>
<p>In the time it takes to go back and forth with someone helping them setup their hosting account, we could have set it up for them and saved everyone some trouble.</p>
<p>That stuff is easy for us, so we figured, why not just let us do all the work?</p>
<p>After all, we know our themes better than anyone, who better to set your site up for you?</p>
<p>This service isn&#8217;t for everyone, and that&#8217;s ok. This is only for our theme customers who don&#8217;t have the time or desire to mess with setting up and maintaining all the technical stuff.</p>
<p>To sweeten the deal, we will throw in a free theme!</p>
<p><a href="http://www.presscoders.com/hosting">Click here, everything you need to know is on this page.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.presscoders.com/2012/02/full-service-theme-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>*New* FitX WordPress Theme Launched!</title>
		<link>http://www.presscoders.com/2012/01/new-fitx-wordpress-theme-launched/</link>
		<comments>http://www.presscoders.com/2012/01/new-fitx-wordpress-theme-launched/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 17:03:42 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Themes]]></category>

		<guid isPermaLink="false">http://www.presscoders.com/?p=3908</guid>
		<description><![CDATA[We are excited to announce the release of our latest theme, FitX. It is our second fitness theme after the success of our very popular FitPro theme. FitX is a vibrant new theme with lots of great features, you can see a demo of it here. Some people asked what is the difference between FitPro [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.presscoders.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/3908.jpg&amp;w=200&amp;h=150&amp;zc=1&amp;ft=png' alt='post thumbnail' /></p>
<p><a href="http://www.presscoders.com/fitx/"><img src="http://www.presscoders.com/wp-content/uploads/2012/01/fitx-feature.jpg" alt="FitX Fitness WordPress Theme" title="FitX Fitness WordPress Theme" width="544" height="300" class="aligncenter size-full wp-image-3891" /></a></p>
<p>We are excited to announce the release of our latest theme, FitX. It is our second fitness theme after the success of our very popular FitPro theme.</p>
<p>FitX is a vibrant new theme with lots of great features, you can see a <a href="http://www.presscoders.com/themes/demo/fitx.php" target="_blank"><strong>demo of it here</strong></a>.</p>
<p>Some people asked what is the difference between FitPro and FitX? Well, FitX has everything FitPro has, and more.  It is built a little differently, more modern features like HTML5, a new rotating testimonial feature, easily change fonts, a custom sidebar feature, and cool custom graphics.</p>
<p>Plus, we have a great new quick start feature included in FitX which is perfect for new sites. Upon theme activation you have the option to setup some default content including new pages (About Us, Contact Us, Blog, Sitemap), and a navigation menu etc.</p>
<p><a href="http://www.presscoders.com/fitx/"><strong>Click here</strong></a> to check out the full FitX details!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.presscoders.com/2012/01/new-fitx-wordpress-theme-launched/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FitPro 2.3 Released, Here are the New Features</title>
		<link>http://www.presscoders.com/2012/01/fitpro-2-3-released/</link>
		<comments>http://www.presscoders.com/2012/01/fitpro-2-3-released/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 19:49:01 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[FitPro Theme]]></category>

		<guid isPermaLink="false">http://www.presscoders.com/?p=3737</guid>
		<description><![CDATA[We have just released the latest version of our fitness WordPress theme, FitPro. The new version (2.3) includes many improvements and bug fixes under the hood, but also some significant updates to existing features. Thanks to our members who gave us feedback, many of the things you requested are in this release! Members Page User [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.presscoders.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/3737.png&amp;w=200&amp;h=150&amp;zc=1&amp;ft=png' alt='post thumbnail' /></p>
<p>We have just released the latest version of our fitness WordPress theme, FitPro. The new version (2.3) includes many improvements and bug fixes under the hood, but also some significant updates to existing features.</p>
<p>Thanks to our members who gave us feedback, many of the things you requested are in this release!</p>
<h2>Members Page User Content</h2>
<p>This feature (FitPro Platinum) has been requested several times and so we decided to add it for more flexibility. When a user logs in they can now edit their profile and add content to their OWN members page. This can be used to allow users to keep a journal entry of their training progress etc.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2012/01/user-profile-box.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2012/01/user-profile-box-300x168.jpg" alt="" title="Individual user added content" width="300" height="168" class="aligncenter size-medium wp-image-3751" /></a></p>
<p>Administrators can add comments in a separate box (this edit box is not visible to the user) as before and also edit/annotate user comments directly.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2012/01/admin-edit-box.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2012/01/admin-edit-box-300x264.jpg" alt="" title="Admin added content" width="300" height="264" class="aligncenter size-medium wp-image-3754" /></a></p>
<h2>E-mail Opt-in Widget</h2>
<p>The opt-in widget (FitPro Platinum) has been significantly updated to include support for 3rd party scripts (Aweber, MailChimp etc.). If you don&#8217;t want to use a 3rd party script then you can make use of the new auto-responder.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2012/01/opt-in-widget.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2012/01/opt-in-widget-106x300.jpg" alt="" title="Opt-in widget update" width="106" height="300" class="aligncenter size-medium wp-image-3766" /></a></p>
<p>To use the auto-responder just enter details directly in the widget settings and when a user submits the opt-in form an e-mail gets automatically sent to them. You do not need to do this manually any more!</p>
<h2>Info Box Widget</h2>
<p>Updated to include more icons, plus a spare one to display any icon image and link. The full list of icons now available are: Facebook, Twitter, YouTube, Flickr, Google+, Linked In, RSS, plus a custom one.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2012/01/update-info-box-widget.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2012/01/update-info-box-widget-145x300.jpg" alt="" title="Updated Info Box Widget" width="145" height="300" class="aligncenter size-medium wp-image-3769" /></a></p>
<p><strong>Be sure to check out the new video tutorial on the FitPro Setup page that explains how to use the new opt-in and info box widgets.</strong></p>
<h2>Content Templates</h2>
<p>Now automatically adds content to post/page editor! No more copy paste (FitPro Platinum). The UI has also been revamped and made more compact too.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2012/01/content-templates.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2012/01/content-templates-300x89.jpg" alt="" title="content-templates" width="300" height="89" class="aligncenter size-medium wp-image-3771" /></a></p>
<h2>New Theme Options Links</h2>
<p>We have added a couple of buttons on the theme options page to link directly to tutorial videos and the FitPro forum.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2012/01/form_options.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2012/01/form_options-300x113.jpg" alt="" title="Theme options buttons" width="300" height="113" class="aligncenter size-medium wp-image-3773" /></a></p>
<h2>Theme Editor CSS</h2>
<p>When editing your posts and pages you will now notice that they don&#8217;t look too dissimilar to how they display on the front end. This is because we have added a style sheet to the post editor to match the styles on the front end.</p>
<p>This should stop you from having to keep flipping back and forth between the post editor and the front end to see what your changes look like!</p>
<h2>Other Updates</h2>
<p>We have also added many bug fixes and code modifications to FitPro 2.3, and it works seamlessly with the latest version of WordPress. The file size of the theme zip file has also been significantly reduced so it uploads even quicker when updating your theme!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.presscoders.com/2012/01/fitpro-2-3-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Latest News</title>
		<link>http://www.presscoders.com/2011/12/latest-news/</link>
		<comments>http://www.presscoders.com/2011/12/latest-news/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 17:03:31 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://www.presscoders.com/?p=3711</guid>
		<description><![CDATA[What&#8217;s going on with the Press Coders lately? Here&#8217;s an update&#8230; WordPressthemes.com David and I are excited to announce that our themes our now included on wordpressthemes.com, a directory for WordPress templates. Community Forum Did you know we have a community forum where you can help and get help with WordPress? Come say hi. Curo [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.presscoders.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/3711.jpg&amp;w=200&amp;h=150&amp;zc=1&amp;ft=png' alt='post thumbnail' /></p>
<p>What&#8217;s going on with the Press Coders lately? Here&#8217;s an update&#8230;</p>
<h3>WordPressthemes.com</h3>
<p>David and I are excited to announce that our themes our now included on wordpressthemes.com, a directory for <a href="http://www.wordpressthemes.com/" title="WordPress templates" target="_blank">WordPress templates</a>.</p>
<h3>Community Forum</h3>
<p>Did you know we have a <a href="http://www.presscoders.com/forums/forumdisplay.php?15-Community-Forum">community forum</a> where you can help and get help with WordPress? Come say hi.</p>
<h3>Curo Theme</h3>
<p>In case you missed it, our third theme Curo was released. It&#8217;s <a href="http://www.presscoders.com/curo/" title="WordPress template for medical and health professionals">a theme for medical and health professionals, check it out.</a></p>
<h3>Our Next Theme</h3>
<p>Our next theme will be a portfolio theme, and it&#8217;s looking pretty sweet if I do say so myself.</p>
<p>It will feature some awesome new functionality, but I don&#8217;t want to give away too much yet. Look for it in early 2012.</p>
<h3>Blog</h3>
<p>There&#8217;s some great stuff in the blog, including <a href="http://www.presscoders.com/2011/11/how-to-reuse-the-post-editor-in-wordpress-3-3/">how to reuse the post editor in WordPress 3.3</a>.  Release candidate 1 was just released, so read up now.</p>
<p>We get a lot of questions about switching hosting, pointing domains to a new server, etc., so we made <a href="http://www.presscoders.com/2011/10/domains-hosting-dns-how-to/">a video to make things clearer.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.presscoders.com/2011/12/latest-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Charity: Water</title>
		<link>http://www.presscoders.com/2011/11/charity-water/</link>
		<comments>http://www.presscoders.com/2011/11/charity-water/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 19:43:25 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://www.presscoders.com/?p=3703</guid>
		<description><![CDATA[We are excited to announce that from here on out we will be donating a portion of every sale to charity: water. They are a fantastic organization that brings clean water to impoverished villages in Africa. 100% of public donations directly fund water projects. You are welcome to donate to our campaign, or just feel [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.presscoders.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/3703.jpg&amp;w=200&amp;h=150&amp;zc=1&amp;ft=png' alt='post thumbnail' /></p>
<p>We are excited to announce that from here on out we will be donating a portion of every sale to <a href="http://www.charitywater.org/" target="_blank">charity: water</a>.</p>
<p>They are a fantastic organization that brings clean water to impoverished villages in Africa. 100% of public donations directly fund water projects. </p>
<p>You are welcome to donate to our campaign, or just feel good knowing that when buying a Press Coders theme you are also contributing to a good cause.</p>
<p>The reason we chose charity: water is because almost 1 billion people don&#8217;t have clean water.  </p>
<p>It is the essential building block for progress: without it you can&#8217;t have better education, better jobs, less hunger, or real development of any kind.  </p>
<p>Check out this video, or check out our <a href="http://mycharitywater.org/presscoders2" target="_blank">campaign page to donate.</a></p>
<p><iframe width="560" height="315" src="http://www.youtube.com/embed/BCHhwxvQqxg?rel=0" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.presscoders.com/2011/11/charity-water/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deactivating a WordPress Plugin Automatically</title>
		<link>http://www.presscoders.com/2011/11/deactivate-wordpress-plugin-automatically/</link>
		<comments>http://www.presscoders.com/2011/11/deactivate-wordpress-plugin-automatically/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 18:02:16 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[automatically]]></category>
		<category><![CDATA[deactivate]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wp_editor]]></category>

		<guid isPermaLink="false">http://www.presscoders.com/?p=3668</guid>
		<description><![CDATA[With every release of WordPress there are so many cool new features to play with. This usually a good thing but one downside is that if you want to incorporate them straightaway into your Plugin it can break versions of WordPress that haven&#8217;t upgraded yet. I had exactly this issue when adding some new code [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.presscoders.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/3668.png&amp;w=200&amp;h=150&amp;zc=1&amp;ft=png' alt='post thumbnail' /></p>
<p>With every release of WordPress there are so many cool new features to play with. This usually a good thing but one downside is that if you want to incorporate them straightaway into your Plugin it can break versions of WordPress that haven&#8217;t upgraded yet.</p>
<p>I had exactly this issue when adding some new code to my <a href="http://wordpress.org/extend/plugins/plugin-options-starter-kit/" target="_blank">Plugin Options Starter Kit</a> Plugin.</p>
<p>I added two new text areas to the Plugin options form that use the built-in WordPress editor. This is made possible by the fantastic wp_editor() function, which is only available in WordPress 3.3 (see my post on this function <a href="http://www.presscoders.com/2011/11/how-to-reuse-the-post-editor-in-wordpress-3-3/" title="How to Reuse the Post Editor in WordPress 3.3" target="_blank">here</a>). However, a lot of users who are already running this Plugin may not have upgraded to WordPress 3.3 (when it is released) by the time I post the Plugin update on WordPress.org.</p>
<p>So where does this leave you? How can you safeguard against Plugin incompatibility with a users version of WordPress. You could insert a simple die() function, but we can do better than that!</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2011/11/wordpress-version.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2011/11/wordpress-version-300x121.jpg" alt="" title="Wordpress Version" width="300" height="121" class="aligncenter size-medium wp-image-3671" /></a></p>
<p>Check out the code below that generates the above message, safely deactivates the incompatible Plugin, and provides a convenient link back to the WordPress admin.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> requires_wordpress_version<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_version</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$plugin</span> <span style="color: #339933;">=</span> plugin_basename<span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">__FILE__</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$plugin_data</span> <span style="color: #339933;">=</span> get_plugin_data<span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">version_compare</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_version</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;3.3&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> is_plugin_active<span style="color: #009900;">&#40;</span><span style="color: #000088;">$plugin</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			deactivate_plugins<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$plugin</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			wp_die<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$plugin_data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' requires WordPress 3.3 or higher! Deactivating Plugin.&lt;br /&gt;&lt;br /&gt;Back to &lt;a href='&quot;</span><span style="color: #339933;">.</span>admin_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&gt;WordPress admin&lt;/a&gt;.&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'admin_init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'requires_wordpress_version'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>So, what&#8217;s going on here?</p>
<p>First, we grab the current version of WordPress stored in the global $wp_version variable. Next, we have two lines of code to store the plugin folder/filename, and the name of the Plugin itself.</p>
<p>Now for the important bit. We use version_compare() to check we are running WordPress 3.3 or higher. If you want to check for a different version just change &#8217;3.3&#8242; to a different value. If your installed version of WordPress is not compatible with the Plugin then we can go ahead and deactivate the Plugin, output a message, and halt the script.</p>
<p>Let&#8217;s check our Plugin is actually activated before we try to deactivate anything. We do this with the is_plugin_active() function. We need to pass in the Plugin folder and filename, which we stored in $plugin earlier. A value of true will be passed back if the Plugin is active.</p>
<p>Once we have confirmation that we can go ahead and deactivate our Plugin we just need to call the deactivate_plugins() function and pass it $plugin. This will actually deactivate the Plugin. The final step is to just call wp_die() with a suitable message. I have also added a link back to the WordPress admin for convenience.</p>
<p>You may be wondering why I am adding the code to a function and triggering it via the &#8216;admin_init&#8217; action hook. Why not just add it outside of a function at the top of the Plugin file?</p>
<p>This is because of the is_plugin_active() function. If you try to call it outside of a function somewhere in your Plugin file, then it won&#8217;t have been defined by WordPress yet and a fatal &#8216;Call to undefined function&#8217; error will be generated. This will also happen if you try to hook the function too early. Try replacing the &#8216;admin_init&#8217; hook with &#8216;plugins_loaded&#8217; instead to see what I mean. As long as you hook the function with &#8216;admin_init&#8217; though everything should be fine.</p>
<p>The function is generic enough to be dropped into any existing Plugin and work right out of the box (neat huh?). The only thing you might need to adjust is the version of WordPress you want to test against.</p>
<p>I hope you find this code snippet useful. As usual let me know what you think in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.presscoders.com/2011/11/deactivate-wordpress-plugin-automatically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Reuse the Post Editor in WordPress 3.3</title>
		<link>http://www.presscoders.com/2011/11/how-to-reuse-the-post-editor-in-wordpress-3-3/</link>
		<comments>http://www.presscoders.com/2011/11/how-to-reuse-the-post-editor-in-wordpress-3-3/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 19:35:34 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp_editor]]></category>

		<guid isPermaLink="false">http://www.presscoders.com/?p=3642</guid>
		<description><![CDATA[If you have been following along with the development of WordPress 3.3 beta you may already be aware of the great new function wp_editor(). It really is a game changer. The WordPress core team deserve a real pat on the back for this one. So what’s all the fuss about? The problem before WP 3.3 [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.presscoders.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/3642.png&amp;w=200&amp;h=150&amp;zc=1&amp;ft=png' alt='post thumbnail' /></p>
<p>If you have been following along with the development of WordPress 3.3 beta you may already be aware of the great new function wp_editor(). It really is a game changer. The WordPress core team deserve a real pat on the back for this one. So what’s all the fuss about?</p>
<p>The problem before WP 3.3 was that if you wanted to reuse the built-in editor, used on posts and pages, you had a real battle on your hands to get it to work. It was just too much hassle for the benefits gained.</p>
<p>In fact, the last time I looked into this I gave up and included the CKEditor JS library instead, as that was really easy to implement. This worked pretty well but not really ideal as the CKEditor library is quite weighty to include with your theme/Plugin.</p>
<p>What I REALLY wanted was be able to use the built-in editor that shipped with WordPress. And now I can! The new wp_editor() function has made the hideously difficult task of re-using the editor ridiculously easy. It’s just so easy now to throw editors at every text area in the WP admin you can shake a stick at, and it will work reliably and consistently every time. How cool is that?</p>
<p>In this post I’ll be creating a simple Plugin and show you how to add two separate instances of the WP editor on the Plugin options page. You will be able to grab the code for the whole Plugin at the end of the post.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2011/11/wp-editor-test.png"><img src="http://www.presscoders.com/wp-content/uploads/2011/11/wp-editor-test-294x300.png" alt="" title="WP Editor Test Plugin" width="294" height="300" class="aligncenter size-medium wp-image-3656" /></a></p>
<p>But first, please bear with me whilst I go through the motions of setting up the Plugin structure. Don’t worry we’ll get to the good stuff soon enough. With this in mind I’m not going to go through every fine detail of the functions needed to set-up a Plugin. I just want to focus on the reusability of the WP editor.</p>
<p>First, let’s register our settings, as we will be using the WordPress Settings API to handle our Plugin options. The code for this is pretty straightforward.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Init plugin options to white list our options</span>
<span style="color: #000000; font-weight: bold;">function</span> wpet_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	register_setting<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wpet_plugin_options'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wpet_options'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wpet_validate_options'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wpet_init'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Now we need an admin page for our Plugin. Again, this is standard stuff.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Add menu page</span>
<span style="color: #000000; font-weight: bold;">function</span> wpet_add_options_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	add_options_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP Editor Test'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'WP Editor Test'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'manage_options'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wpet_render_form'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wpet_add_options_page'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This will add a Plugin options page under the Settings top level menu with the title ‘WP Editor Test’. Now for the good part.<br />
We need a function to render the form, but let’s break this down a bit. To start with, the Plugin options form uses the post method, with option.php used for the action attribute. Inside the form tags, and before any form fields are rendered let’s add two lines of code to handle all the Settings API details for us.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">settings_fields<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wpet_plugin_options'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wpet_options'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Now we can render all our form fields safe in the knowledge that the Settings API is looking after us and giving us all the correct values and settings. We just need one Plugin option for now, a simple text area.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;textarea id=&quot;wpet_options[textarea_three]&quot; name=&quot;wpet_options[textarea_three]&quot; rows=&quot;7&quot; cols=&quot;150&quot; type='textarea'&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'textarea_three'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/textarea&gt;</pre></td></tr></table></div>

<p>All we need to do now is add a form submit button so all the loading/saving of the text area content will be handled for us! Sweet.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;p class=&quot;submit&quot;&gt;&lt;input type=&quot;submit&quot; class=&quot;button-primary&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Save Changes'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;&lt;/p&gt;
&lt;/p&gt;
&nbsp;
OK, so this is all fine and good for bog standard text areas but what about using the funky WP editor as a replacement? This is way easier than you might think. You’re gonna love this.
Simply replace the text area tag above with:
&nbsp;
&lt;pre lang=&quot;php&quot; line=&quot;1&quot;&gt;
$args = array(&quot;textarea_name&quot; =&gt; &quot;wpet_options[textarea_one]&quot;);
wp_editor( $options['textarea_one'], &quot;wpet_options[textarea_one]&quot;, $args );</pre></td></tr></table></div>

<p>Basically, all you need to do is call the wp_editor() function and pass it an ID and some optional arguments. The first parameter is the actual content of the text area which we are pulling from the options db table, via the Settings API. Next we add in the ID of the text area as the second parameter. Finally, the third parameter accepts an array of settings you can use to customise the editor.</p>
<p>In this example we are just specifying one array parameter in $args which sets the name of the text area too. These are both the same in this case so we could have actually left this out altogether, as ‘textarea_name’ defaults to the ID name. I explicitly left it in as it’s a good idea to see what’s happening, on a first exposure.</p>
<p>Note: There is currently no WordPress Codex page for wp_editor() at the time of writing (November, 2011) so you will have to dig around the WordPress core to find out more about the parameters available.</p>
<p>Right, want more editors? You got it. We can easily add another instance of the WP editor. Check this out:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;textarea_name&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;wpet_options[textarea_two]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
wp_editor<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'textarea_two'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;wpet_options[textarea_two]&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Just make sure that you change the ID and name parameters to point to a new text area and bingo, we have two separate instances of our editor. That’s almost too easy!</p>
<p>You might have noticed that when we defined the register_setting() function the third parameter was specified as the &#8216;wpet_validate_options&#8217; callback function. This is a validation function that you can pass your text area content through as it is saved. The callback is defined in the Plugin as:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> wpet_validate_options<span style="color: #009900;">&#40;</span><span style="color: #000088;">$input</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Sanitize textarea input (strip html tags, and escape characters)</span>
	<span style="color: #666666; font-style: italic;">//$input['textarea_one'] = wp_filter_nohtml_kses($input['textarea_one']);</span>
	<span style="color: #666666; font-style: italic;">//$input['textarea_two'] = wp_filter_nohtml_kses($input['textarea_two']);</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$input</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>I have commented out the lines to validate and strip HTML tags as I want to keep the formatting. This validation function is really useful when you DO want to remove tags from text areas. </p>
<p>The full Plugin code is shown below. Copy it into a text file, save it as wp-editor-test.php, and add to your ‘/wp-content/plugins/’ folder. Just activate it, and visit the Plugin options page under the Settings menu.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Plugin Name: WP Editor Test
Plugin URI: http://www.presscoders.com/
Description: Test Plugin to get the WP editor working on a Plugin admin page.
Version: 0.1
Author: David Gwyer
Author URI: http://www.presscoders.com
*/</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Init plugin options to white list our options</span>
<span style="color: #000000; font-weight: bold;">function</span> wpet_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	register_setting<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wpet_plugin_options'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wpet_options'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wpet_validate_options'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wpet_init'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Add menu page</span>
<span style="color: #000000; font-weight: bold;">function</span> wpet_add_options_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	add_options_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP Editor Test'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'WP Editor Test'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'manage_options'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wpet_render_form'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wpet_add_options_page'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Render the Plugin options form</span>
<span style="color: #000000; font-weight: bold;">function</span> wpet_render_form<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;div class=&quot;wrap&quot;&gt;
		&lt;div class=&quot;icon32&quot; id=&quot;icon-options-general&quot;&gt;&lt;br&gt;&lt;/div&gt;
		&lt;h2&gt;WP Editor Test&lt;/h2&gt;
		&lt;form method=&quot;post&quot; action=&quot;options.php&quot;&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> settings_fields<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wpet_plugin_options'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wpet_options'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
			&lt;table class=&quot;form-table&quot;&gt;
				&lt;tr&gt;
					&lt;td&gt;
						&lt;h3&gt;TinyMCE - Editor 1&lt;/h3&gt;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span>
							<span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;textarea_name&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;wpet_options[textarea_one]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
							wp_editor<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'textarea_one'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;wpet_options[textarea_one]&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
						<span style="color: #000000; font-weight: bold;">?&gt;</span>
					&lt;/td&gt;
				&lt;/tr&gt;
				&lt;tr&gt;
					&lt;td&gt;
						&lt;h3&gt;TinyMCE - Editor 2&lt;/h3&gt;
						<span style="color: #000000; font-weight: bold;">&lt;?php</span>
							<span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;textarea_name&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;wpet_options[textarea_two]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
							wp_editor<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'textarea_two'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;wpet_options[textarea_two]&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
						<span style="color: #000000; font-weight: bold;">?&gt;</span>
					&lt;/td&gt;
				&lt;/tr&gt;
				&lt;tr&gt;
					&lt;td&gt;
						&lt;h3&gt;Textarea - Editor 3&lt;/h3&gt;
						&lt;textarea id=&quot;wpet_options[textarea_three]&quot; name=&quot;wpet_options[textarea_three]&quot; rows=&quot;7&quot; cols=&quot;150&quot; type='textarea'&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'textarea_three'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/textarea&gt;
					&lt;/td&gt;
				&lt;/tr&gt;
			&lt;/table&gt;
			&lt;p class=&quot;submit&quot;&gt;
			&lt;input type=&quot;submit&quot; class=&quot;button-primary&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Save Changes'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
			&lt;/p&gt;
		&lt;/form&gt;
	&lt;/div&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span>	
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Sanitize and validate input. Accepts an array, return a sanitized array.</span>
<span style="color: #000000; font-weight: bold;">function</span> wpet_validate_options<span style="color: #009900;">&#40;</span><span style="color: #000088;">$input</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Sanitize textarea input (strip html tags, and escape characters)</span>
	<span style="color: #666666; font-style: italic;">//$input['textarea_one'] = wp_filter_nohtml_kses($input['textarea_one']);</span>
	<span style="color: #666666; font-style: italic;">//$input['textarea_two'] = wp_filter_nohtml_kses($input['textarea_two']);</span>
	<span style="color: #666666; font-style: italic;">//$input['textarea_three'] = wp_filter_nohtml_kses($input['textarea_three']);</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$input</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Note: The code in this post applies to WordPress 3.3 beta 2 which may see some tweaks to the way wp_editor() works before final release. So if you implement any code from this post in your own Plugins then make sure it still works in WP 3.3 final.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.presscoders.com/2011/11/how-to-reuse-the-post-editor-in-wordpress-3-3/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Back to Basics: Domains, Hosting, DNS&#8230;How Does It All Work?</title>
		<link>http://www.presscoders.com/2011/10/domains-hosting-dns-how-to/</link>
		<comments>http://www.presscoders.com/2011/10/domains-hosting-dns-how-to/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 18:22:12 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>

		<guid isPermaLink="false">http://www.presscoders.com/?p=3624</guid>
		<description><![CDATA[Ever wondered how website domains and hosting work? Do you need to change your DNS? Do you have your domain in one place and your hosting in another? This video explains how it all works.]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.presscoders.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/3624.png&amp;w=200&amp;h=150&amp;zc=1&amp;ft=png' alt='post thumbnail' /></p>
<p>Ever wondered how website domains and hosting work? Do you need to change your DNS? Do you have your domain in one place and your hosting in another?</p>
<p>This video explains how it all works.</p>
<p><span id="more-3624"></span></p>
<p><iframe width="590" height="330" src="http://www.youtube.com/embed/opMQ1y3SnsU?rel=0&amp;hd=1" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.presscoders.com/2011/10/domains-hosting-dns-how-to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Plugin &#8211; Format Media Titles</title>
		<link>http://www.presscoders.com/2011/10/new-plugin-format-media-titles/</link>
		<comments>http://www.presscoders.com/2011/10/new-plugin-format-media-titles/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 13:43:46 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://www.presscoders.com/?p=3601</guid>
		<description><![CDATA[If you have ever uploaded many images/videos etc. via the WordPress media uploader you will now that it can be pretty tedious to have to manually edit the title for new media items. &#8216;Format Media Titles&#8217; is a new Plugin to automatically format the media title for new uploads. It works by replacing characters such [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.presscoders.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/3601.jpg&amp;w=200&amp;h=150&amp;zc=1&amp;ft=png' alt='post thumbnail' /></p>
<p>If you have ever uploaded many images/videos etc. via the WordPress media uploader you will now that it can be pretty tedious to have to manually edit the title for new media items.</p>
<p>&#8216;Format Media Titles&#8217; is a new Plugin to automatically format the media title for new uploads. It works by replacing characters such as hyphens, and underscores, with spaces. The title can then be capitalized by a method of your choice.</p>
<p>See the image below for a before and after view of the same image uploaded with and without the Plugin activated.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2011/10/before_after.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2011/10/before_after-285x300.jpg" alt="" title="Before and After" width="285" height="300" class="aligncenter size-medium wp-image-3602" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.presscoders.com/2011/10/new-plugin-format-media-titles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better Theme Activation Handling</title>
		<link>http://www.presscoders.com/2011/10/better-theme-activation-handling/</link>
		<comments>http://www.presscoders.com/2011/10/better-theme-activation-handling/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 23:54:39 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[WordPress 3.x]]></category>

		<guid isPermaLink="false">http://www.presscoders.com/?p=3526</guid>
		<description><![CDATA[Here at Press Coders we are never happy with making do with the same old functionality. We constantly re-evaluate the way we do things and always look to improve on user experience. So, what have we been up to? Well, one thing that bugs us is that when activating a theme for the first time [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.presscoders.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/3526.jpg&amp;w=200&amp;h=150&amp;zc=1&amp;ft=png' alt='post thumbnail' /></p>
<p>Here at Press Coders we are never happy with making do with the same old functionality. We constantly re-evaluate the way we do things and always look to improve on user experience. So, what have we been up to?</p>
<p>Well, one thing that bugs us is that when activating a theme for the first time your site can typically look less than amazing. That is until you create some content and complete some initial configuration including:</p>
<ul>
<li>Posts</li>
<li>Pages (About Us, Contact Us, Sitemap etc.)</li>
<li>Navigation Menu (and setting the Theme Location)</li>
<li>Widgets and adding them to widget areas</li>
</ul>
<p>Wouldn&#8217;t it be cool to be able to (optionally) install this content automatically when activating a theme on a new site?</p>
<p>Yes, we thought so too, and that&#8217;s why we added it to our theme framework! <span class="no-img-border"> <img src="http://www.presscoders.com/wp-includes/images/smilies/icon_smile.gif" alt=";)" class="wp-smiley"> </span></p>
<p>The actual code of creating the default content will be left to another post. In this post we want to focus on what happens on the theme activation side, and demonstrate how our framework makes it a snap to change this behavior when activating the theme.</p>
<p>Let&#8217;s see what a bog standard theme activation looks like.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2011/10/bog_standard_activation.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2011/10/bog_standard_activation-300x135.jpg" alt="" title="Bog standard activation message" width="300" height="135" class="aligncenter size-medium wp-image-3527" /></a></p>
<p>OK, so here we have added an extra admin notice to show we have activated a theme, and even thrown in a link to the theme options page for good measure. But it still isn&#8217;t great.</p>
<p>For one thing, the default activation message feels a little outdated. I mean, what theme doesn&#8217;t support widgets these days? So let&#8217;s start by removing this default activation message. We are safe to do this because we know that all our current and future themes will ALWAYS support widgets.</p>
<p>How do we do this exactly? Well, we need to make sure our code runs when a theme is activated. There is no built-in WordPress hook for this (seriously) but we can use the following to achieve the same thing.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$pagenow</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'activated'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$pagenow</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;themes.php&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	 <span style="color: #666666; font-style: italic;">/* Show theme activation message, and setup them option defaults. */</span>
	add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'admin_notices'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'theme_activated'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>We can add code to the &#8216;theme_activated&#8217; callback function that will be executed every time a theme is activated. You may have noticed that this callback is referenced via class method syntax. This is because we are using classes rather than standard functions, thus the callback references need to be modified slightly.</p>
<p>Inside our callback function we have a line of jQuery code to remove the standard WordPress theme activation notice.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">?&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
	jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#message2'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'display'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'none'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;?php</pre></td></tr></table></div>

<p>Now that is gone we can add our own message when the theme is activated.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2011/10/new_default_activation_message.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2011/10/new_default_activation_message-300x135.jpg" alt="" title="New Activation Message" width="300" height="135" class="aligncenter size-medium wp-image-3541" /></a></p>
<p>This is getting a little better now. We have a more relevant message with some buttons to go to the site home page, or theme options page.</p>
<p>But what about the default content mentioned earlier? Well, in the functions.php file we have two constants (INSTALL_DEFAULT_CONTENT, and INSTALL_CONTENT_PROMPT) that we can alter to change the activation message/behavior.</p>
<p>When INSTALL_DEFAULT_CONTENT is set to FALSE (the default setting) the above theme activation message is shown. But when it is set to TRUE we see a new activation message.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2011/10/install_default_content_prompt.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2011/10/install_default_content_prompt-300x181.jpg" alt="" title="Install Default Content" width="300" height="181" class="aligncenter size-medium wp-image-3544" /></a></p>
<p>You can decide whether to install the default content or just go straight to the theme options page (or any other page you want to). To prevent accidental installation of default content the is an alert box that pops up to make sure you want to go ahead.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2011/10/are_you_sure.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2011/10/are_you_sure-300x181.jpg" alt="" title="Are You Sure?" width="300" height="181" class="aligncenter size-medium wp-image-3548" /></a></p>
<p>And if you do choose to install the default content, you get a confirmation message after completion.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2011/10/default_content_installed.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2011/10/default_content_installed-300x136.jpg" alt="" title="Default Content Installed" width="300" height="136" class="aligncenter size-medium wp-image-3550" /></a></p>
<p>The second constant, INSTALL_CONTENT_PROMPT, is only relevant if INSTALL_DEFAULT_CONTENT is set to TRUE. It is used to decide whether the default content to be installed should be installed automatically or prompt the user first.</p>
<p>We have already seen the effect of having INSTALL_CONTENT_PROMPT set to TRUE above where the default content is ONLY installed if the user specifies. If set to FALSE then the default content is installed silently in the background.</p>
<p>In this case the activation message is the same as before (see screenshot below) when INSTALL_DEFAULT_CONTENT was initially set to FALSE.</p>
<p><a href="http://www.presscoders.com/wp-content/uploads/2011/10/new_default_activation_message.jpg"><img src="http://www.presscoders.com/wp-content/uploads/2011/10/new_default_activation_message-300x135.jpg" alt="" title="New Activation Message" width="300" height="135" class="aligncenter size-medium wp-image-3541" /></a></p>
<p>Why bother to install default content in the background without giving the user a choice? Well this option is pretty useful in situations where you ALWAYS want to make sure default content is installed every time a theme is activated. We already have one clear use in mind for this feature, for a proposed theme test area. Users will be able to sign up for an account and get full admin access to a blog where they can try out any of our themes.</p>
<p>In this scenario, it suddenly becomes clear that being able auto-install default content upon theme activation is pretty useful. This is a great way to show off a theme to its full potential right from the start, without the user having to do any initial configuration.</p>
<p>The theme activation feature discussed in this post is really still a work in progress, and the final implementation will almost certainly change before we use this in a production theme. But, we were pretty excited by this new addition to our theme framework, and wanted to share our development progress!</p>
<p>So let us know what you think in the comments. Would you find this feature useful?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.presscoders.com/2011/10/better-theme-activation-handling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

