<?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>John Kolbert WordPress Consulting</title>
	<atom:link href="http://www.johnkolbert.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johnkolbert.com</link>
	<description></description>
	<lastBuildDate>Sun, 20 Dec 2009 00:02:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Change How Often WordPress 2.9 Takes Out the Trash</title>
		<link>http://www.johnkolbert.com/wordpress/change-how-often-wordpress-2-9-takes-out-the-trash/</link>
		<comments>http://www.johnkolbert.com/wordpress/change-how-often-wordpress-2-9-takes-out-the-trash/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 00:02:06 +0000</pubDate>
		<dc:creator>John Kolbert</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.johnkolbert.com/?p=439</guid>
		<description><![CDATA[The recent release of WordPress 2.9 brought a great new feature: the trash. Now users have a way to recover deleted posts and comments. By default, WordPress empties the trash every 30 days. If you&#8217;d like to change how often the trashed information is removed, simply open up wp-config.php and [...]]]></description>
			<content:encoded><![CDATA[<p>The recent release of <a href="http://wordpress.org/development/2009/12/wordpress-2-9/">WordPress 2.9</a> brought a great new feature: the trash. Now users have a way to recover deleted posts and comments. By default, WordPress empties the trash every 30 days. If you&#8217;d like to change how often the trashed information is removed, simply open up wp-config.php and define the following constant:</p>
<pre class="brush: php;">define('EMPTY_TRASH_DAYS', 15 );  // 15 days</pre>
<p>Just change 15 to the frequency in days that you want WordPress to empty the trash. It&#8217;s that simple!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnkolbert.com/wordpress/change-how-often-wordpress-2-9-takes-out-the-trash/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>MammothApps WordPress Development Studio Has Launched</title>
		<link>http://www.johnkolbert.com/site-news/mammothapps-wordpress-development-studio-has-launched/</link>
		<comments>http://www.johnkolbert.com/site-news/mammothapps-wordpress-development-studio-has-launched/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 08:23:10 +0000</pubDate>
		<dc:creator>John Kolbert</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.johnkolbert.com/?p=437</guid>
		<description><![CDATA[I&#8217;m very excited to announce the official launch of MammothApps, a development studio specializing in advanced web applications and large-scale plugins built on the WordPress content management system (CMS). The former &#8220;John Kolbert WordPress Consulting&#8221; has lost its self-indulgent name and split to a completely separate entity. All of my [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m very excited to announce the official launch of <a href="http://www.mammothapps.com/">MammothApps</a>, a development studio specializing in advanced web applications and large-scale plugins built on the <a href="http://www.wordpress.org">WordPress </a>content management system (CMS). The former &#8220;John Kolbert WordPress Consulting&#8221; has lost its self-indulgent name and split to a completely separate entity. All of my development focus will now be over at MammothApps.</p>
<p><strong>What is MammothApps?</strong> From the <a href="http://www.mammothapps.com/about/">about page</a>:</p>
<blockquote><p>&#8220;MammothApps is a WordPress development studio owned and operated by John Kolbert. Based out of Minneapolis, MN, MammothApps’ typical clients are looking for medium to large scale custom plugins or websites that require advanced functionality (such as e-commerce, or social networking). However, MammothApps offers a wide range of <a style="outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: #4992c4; font-family: Arial, Helvetica, sans-serif; padding: 0px; margin: 0px;" title="View services offered by MammothApps" href="http://www.mammothapps.com/services/">WordPress-related services</a>.</p></blockquote>
<p><strong>Why, you may ask?</strong></p>
<p>Put simply: <em>growth</em>. I&#8217;ve been blessed to be much busier then I expected with client projects. So much so, in fact, that I haven&#8217;t updated this website in four entire months. With MammothApps, I&#8217;m branching out. I&#8217;m officially declaring: I mean business. I&#8217;ve networked with several other talented developers who will be providing support and skills on larger scale projects overseen by MammothApps. We&#8217;ll be focusing primarily on larger scale (maybe even, mammoth?), custom plugins and applications, all built on WordPress. All of my WordPress-related developing will occur through the MammothApps studio.</p>
<p>JohnKolbert.com will become entirely my personal blog. All references to my former freelance consulting services have been removed or redirected to the MammothApps homepage.</p>
<p>I&#8217;ll hope you join me over at <a href="http://www.mammothapps.com/">MammothApps</a>. In addition to client work, we&#8217;ll be publishing a series of  advanced WordPress tutorials, called MammothTips each month, as well as releasing some pretty awesome WordPress based web applications (details forthcoming).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnkolbert.com/site-news/mammothapps-wordpress-development-studio-has-launched/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Absolute Privacy Updated to v1.2</title>
		<link>http://www.johnkolbert.com/wordpress/absolute-privacy-updated-to-v1-2/</link>
		<comments>http://www.johnkolbert.com/wordpress/absolute-privacy-updated-to-v1-2/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 19:51:39 +0000</pubDate>
		<dc:creator>John Kolbert</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.johnkolbert.com/?p=434</guid>
		<description><![CDATA[I just released v1.2 of my Absolute Privacy WordPress plugin. Absolute Privacy is a plugin which makes your blog only accessible to logged in users. It also lets users register themselves, choose a password, but have to be approved before being able to log in.
This update was mainly to fix [...]]]></description>
			<content:encoded><![CDATA[<p>I just released v1.2 of my <a href="/portfolio/wp-plugins/absolute-privacy/">Absolute Privacy</a> WordPress plugin. Absolute Privacy is a plugin which makes your blog only accessible to logged in users. It also lets users register themselves, choose a password, but have to be approved before being able to log in.</p>
<p>This update was mainly to fix an XML-RPC authentication issue that prevented remote publishing apps (like the iPhone WordPress app) from communicating with private blogs. I tested the iPhone app on a blog running 2.8.2 with no problems. I haven&#8217;t tested other remote applications, so your feedback would be appreciated.</p>
<p>I also added the ability to prevent blog subscribers from accessing any admin pages. Normally they have access to a profile page and a dumbed-down dashboard. If enabled, they&#8217;ll now be redirected to the main blog page if trying to reach any admin page.</p>
<p>And finally, some users running WordPress 2.8 were permission errors when clicking the link to approve users. Version 1.2 fixes this issue.</p>
<p>Visit the <a href="/portfolio/wp-plugins/absolute-privacy/">Absolute Privacy homepage</a> to read more and download. Don&#8217;t forget to <a href="/donate/?plugin=absolute-privacy">donate if you found this update useful</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnkolbert.com/wordpress/absolute-privacy-updated-to-v1-2/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>New Theme, Same Great Stuff</title>
		<link>http://www.johnkolbert.com/site-news/new-theme-same-great-stuff/</link>
		<comments>http://www.johnkolbert.com/site-news/new-theme-same-great-stuff/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 06:43:33 +0000</pubDate>
		<dc:creator>John Kolbert</dc:creator>
				<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://www.johnkolbert.com/?p=427</guid>
		<description><![CDATA[I&#8217;ve just activated the new theme for my website. It&#8217;s a nice HTML template that I&#8217;ve converted to a WordPress theme. You&#8217;ll notice there is a much larger emphasis on services I offer and my portfolio. Please leave any feedback you have regarding the layout, broken links, etc.
Here&#8217;s a few [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just activated the new theme for my website. It&#8217;s a nice HTML template that I&#8217;ve converted to a WordPress theme. You&#8217;ll notice there is a much larger emphasis on services I offer and my portfolio. Please leave any feedback you have regarding the layout, broken links, etc.</p>
<p>Here&#8217;s a few highlights of the changes I&#8217;ve made.</p>
<h3>Display My Services</h3>
<p>The largest change is that the homepage now displays services I offer prominently and de-emphasizes the blog somewhat. This change is to allow me to focus more on client work and to have potential clients recognize the services I offer.</p>
<p style="text-align: center; "><a href="http://www.johnkolbert.com/wp-content/uploads/2009/07/services.jpg"><img class="size-full wp-image-428 border aligncenter" title="services" src="http://www.johnkolbert.com/wp-content/uploads/2009/07/services.jpg" alt="services" width="550" height="195" /></a></p>
<h3>Portfolio</h3>
<p>I&#8217;ve finally added a <a href="/portfolio/">decent portfolio</a>. Right now the portfolio is displaying ten recent projects I&#8217;ve worked on, minus the non-disclosures (obviously).</p>
<p style="text-align: center; "><img class="aligncenter size-full wp-image-429 border" title="portfolio" src="http://www.johnkolbert.com/wp-content/uploads/2009/07/portfolio.jpg" alt="portfolio" width="550" height="310" /></p>
<h3>Dedicated Donation Page</h3>
<p style="text-align: left; ">I&#8217;ve also added a <a href="/donate/">dedicated donation page</a> to allow people who have enjoyed my plugins and/or services to donate anytime they like. The form processing is handled through PayPal.</p>
<p style="text-align: left;"><a href="http://www.johnkolbert.com/donate/"><img class="size-full wp-image-430 aligncenter" title="donation" src="http://www.johnkolbert.com/wp-content/uploads/2009/07/donation.jpg" alt="donation border" width="486" height="303" /></a></p>
<h3>Updated Plugin Pages</h3>
<p style="text-align: left;">I&#8217;ve also updated the plugin pages for plugins I&#8217;ve released. They use the same graphic as the donation page with a different text overlay.</p>
<h3><img class="aligncenter size-full wp-image-431 border" title="Picture 1" src="http://www.johnkolbert.com/wp-content/uploads/2009/07/Picture-1.jpg" alt="Picture 1" width="489" height="305" />Feedback</h3>
<p>Remember to leave any feedback in the comments or feel free to <a href="/contact/email/">email me</a> with any you have.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnkolbert.com/site-news/new-theme-same-great-stuff/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Show Your Latest Tweet In 5 Lines of Code</title>
		<link>http://www.johnkolbert.com/wordpress/show-your-latest-tweet-in-5-lines-of-code/</link>
		<comments>http://www.johnkolbert.com/wordpress/show-your-latest-tweet-in-5-lines-of-code/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 05:22:12 +0000</pubDate>
		<dc:creator>John Kolbert</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.johnkolbert.com/?p=410</guid>
		<description><![CDATA[While working on the redesign of my website I realized I was using a very inefficient method of displaying my latest Twitter post (&#8220;Tweet&#8221;). Currently I&#8217;m using a script I found online that uses two functions that are just over 20 lines of code total. Here I&#8217;ll show you how [...]]]></description>
			<content:encoded><![CDATA[<p>While working on the redesign of my website I realized I was using a very inefficient method of displaying my latest Twitter post (&#8220;Tweet&#8221;). Currently I&#8217;m using a script I found online that uses two functions that are just over 20 lines of code total. Here I&#8217;ll show you how to use WordPress&#8217; built in RSS parser to display your latest tweet in 5 lines of code.</p>
<p><strong>Note:</strong> An important aside about this script is that by default WordPress caches the feed for 1 hour. This means your Tweet on your website will be updated at that frequency. This is great because it saves your server a lot of overhead, especially on busy website. However, if you&#8217;re an avid Twitterer and want your very latest Tweet shown for every page refresh for every visitor, I recommend <a href="http://www.wprecipes.com/how-to-display-your-latest-twitter-entry-on-your-wp-blog">using this method</a>.</p>
<pre class="brush: php;">

function wp_echoTwitter($username){
     include_once(ABSPATH.WPINC.'/rss.php');
     $tweet = fetch_rss(&quot;http://search.twitter.com/search.atom?q=from:&quot; . $username . &quot;&amp;rpp=1&quot;);
     echo $tweet-&gt;items[0]['atom_content'];
}
</pre>
<p>Past the above in your functions.php file. Now just paste the following in your theme file where you want your Twitter post to appear:</p>
<pre class="brush: php;">

&lt;?php wp_echoTwitter('johnkolbert'); ?&gt;
</pre>
<p>Obviously replace my username with yours. Now you&#8217;re done! Style it however you like with HTML and CSS.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnkolbert.com/wordpress/show-your-latest-tweet-in-5-lines-of-code/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Smart Ads WP Plugin Updated to v2.2</title>
		<link>http://www.johnkolbert.com/site-news/smart-ads-wp-plugin-updated-to-v2-2/</link>
		<comments>http://www.johnkolbert.com/site-news/smart-ads-wp-plugin-updated-to-v2-2/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 20:02:53 +0000</pubDate>
		<dc:creator>John Kolbert</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.johnkolbert.com/?p=408</guid>
		<description><![CDATA[Last night I updated Smart Ads to version 2.2. This fixes an issue where posts that had ads disabled would randomly have ads become re-enabled. It also includes a changelog in the readme so automatic upraders can view the changes right from their dashboard.
What&#8217;s Smart Ads, you ask? Smart Ads [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I updated <a href="http://www.johnkolbert.com/portfolio/wp-plugins/smart-ads/">Smart Ads </a>to version 2.2. This fixes an issue where posts that had ads disabled would randomly have ads become re-enabled. It also includes a changelog in the readme so automatic upraders can view the changes right from their dashboard.</p>
<p>What&#8217;s Smart Ads, you ask? <a href="http://www.johnkolbert.com/portfolio/wp-plugins/smart-ads/">Smart Ads</a> is an intelligent advertising plugin for WordPress. It lets you insert ads based on category, wordcount, member status, post age, and more.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnkolbert.com/site-news/smart-ads-wp-plugin-updated-to-v2-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Smart Ads WordPress Plugin Hits 10,000 Downloads</title>
		<link>http://www.johnkolbert.com/site-news/smart-ads-wordpress-plugin-hits-10000-downloads/</link>
		<comments>http://www.johnkolbert.com/site-news/smart-ads-wordpress-plugin-hits-10000-downloads/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 04:36:58 +0000</pubDate>
		<dc:creator>John Kolbert</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.johnkolbert.com/?p=387</guid>
		<description><![CDATA[A little over a year ago I released a WordPress plugin called Smart Ads. I had been looking for a plugin that would assist me in adding advertisements to Simply-Basic.com, my technology blog (now defunct), but  I couldn&#8217;t find one that I felt did everything I needed it to. After [...]]]></description>
			<content:encoded><![CDATA[<p>A little over a year ago I released a WordPress plugin called <a href="http://www.johnkolbert.com/portfolio/wp-plugins/smart-ads/">Smart Ads</a>. I had been looking for a plugin that would assist me in adding advertisements to Simply-Basic.com, my technology blog (now defunct), but  I couldn&#8217;t find one that I felt did everything I needed it to. After creating what I felt was the perfect advertising solution for myself, I released it to the public.</p>
<p>Well I&#8217;m happy to say that in just over a year, <strong>Smart Ads has been downloaded over 10,000 <a href="http://wordpress.org/extend/plugins/smart-ads/stats/">from WordPress.org</a></strong>! It&#8217;s quite a milestone for Smart Ads and myself personally, as it is my most popular plugin. I told my wife today and her response was &#8220;Why didn&#8217;t you just charge $1 for it!&#8221; You can tell she has more business sense then I do!</p>
<p>If you&#8217;d like to give Smart Ads a try, <a href="http://www.johnkolbert.com/portfolio/wp-plugins/smart-ads/">check out it&#8217;s homepage</a>. It&#8217;s fully compatible with WordPress 2.8 and absolutely free.</p>
<p><a href="http://www.johnkolbert.com/wp-content/uploads/2009/06/smartadsdownloads.jpg"><img class="aligncenter size-full wp-image-389" title="Smart Ads Download Stats" src="http://www.johnkolbert.com/wp-content/uploads/2009/06/smartadsdownloads.jpg" alt="Smart Ads Download Stats" width="350" height="380" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnkolbert.com/site-news/smart-ads-wordpress-plugin-hits-10000-downloads/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>WP Plugin Absolute Privacy v1.1 Released</title>
		<link>http://www.johnkolbert.com/site-news/wp-plugin-absolute-privacy-v1-1-released/</link>
		<comments>http://www.johnkolbert.com/site-news/wp-plugin-absolute-privacy-v1-1-released/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 04:08:43 +0000</pubDate>
		<dc:creator>John Kolbert</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.johnkolbert.com/?p=382</guid>
		<description><![CDATA[I&#8217;ve released an update to the Absolute Privacy WordPress plugin. This release fixes a bug where some Internet Explorer users were unable to login. It also tweaks a few things to provide for WordPress 2.8 compatibility. This is a recommended update for all users.
What is Absolute Privacy, you ask? It [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve released an update to the <a href="http://www.johnkolbert.com/portfolio/wp-plugins/absolute-privacy/">Absolute Privacy WordPress plugin</a>. This release fixes a bug where some Internet Explorer users were unable to login. It also tweaks a few things to provide for WordPress 2.8 compatibility. This is a recommended update for all users.</p>
<p><em>What is Absolute Privacy</em>, you ask? It is a WordPress plugin which turns your blog into the ultimate private blog.</p>
<ul>
<li>Force registrants to enter first and last name</li>
<li>Allow registrants to choose their own passwords</li>
<li>Moderate users: new registrants cannot login until approved</li>
<li>Get emailed every time an approval is waiting (with a link for quick approval)</li>
<li>Lock out all non-logged in views from your website (configurable)</li>
<li><strong>Perfect for family blogs, personal sites, and private communities!</strong></li>
</ul>
<p>To download or read more, please visit the <a href="http://www.johnkolbert.com/portfolio/wp-plugins/absolute-privacy/">Absolute Privacy homepage</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnkolbert.com/site-news/wp-plugin-absolute-privacy-v1-1-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Smart Ads WP Plugin Updated to v2.1</title>
		<link>http://www.johnkolbert.com/wordpress/smart-ads-wp-plugin-updated-to-v21/</link>
		<comments>http://www.johnkolbert.com/wordpress/smart-ads-wp-plugin-updated-to-v21/#comments</comments>
		<pubDate>Fri, 29 May 2009 17:30:10 +0000</pubDate>
		<dc:creator>John Kolbert</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://www.johnkolbert.com/?p=380</guid>
		<description><![CDATA[I just updated the Smart Ads WordPress plugin to version 2.1. It fixes a PHP error that users were getting before they input any ad code into the settings page. Turns out it was a dumb coding mistake on my part. I fixed the code logic on one line and [...]]]></description>
			<content:encoded><![CDATA[<p>I just updated the <a href="http://www.johnkolbert.com/portfolio/wp-plugins/smart-ads/">Smart Ads</a> WordPress plugin to version 2.1. It fixes a PHP error that users were getting before they input any ad code into the settings page. Turns out it was a dumb coding mistake on my part. I fixed the code logic on one line and now it works as intended. Head over to the <a href="http://www.johnkolbert.com/forum/smart-ads/">support forums</a> if you have any questions or see any more bugs.</p>
<p>What is Smart Ads?</p>
<blockquote><p>Smart Ads automatically, yet intelligently inserts advertisements like Google’s Adsense above and below your post content. These advertisements are only visible when viewing a single post (single.php). Since it doesn’t make sense to fill small posts with ads, users can set a “Wordcount” minimum for their advertisements. Smart Ads will only insert advertisements into posts that meet or exceed the desired Wordcount. Do you start your posts with an image? You can chose to disable the top ad if your post has an image tag in the first number of characters (you set the limit)!</p>
<p>Also, to ensure that new content remains fresh, users can chose to only place ads on posts that are over a certain amount of days old. Advertisements can be manually disabled on a post-by-post basis while writing a post, for entire categories, or for registered blog members.</p>
<p>You can also insert custom ads anywhere in your post text using the built in shortcode. Custom ads are not affected by the Wordcount or date minimum requirements and can toggled to be shown on the index page or only shown when in single post view.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.johnkolbert.com/wordpress/smart-ads-wp-plugin-updated-to-v21/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Native Syntax Highlighting and Line Numbering to Your Plugin with WP 2.8</title>
		<link>http://www.johnkolbert.com/wordpress/add-native-syntax-highlighting-and-line-numbering-to-your-plugin-with-wp-28/</link>
		<comments>http://www.johnkolbert.com/wordpress/add-native-syntax-highlighting-and-line-numbering-to-your-plugin-with-wp-28/#comments</comments>
		<pubDate>Thu, 28 May 2009 05:33:26 +0000</pubDate>
		<dc:creator>John Kolbert</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.johnkolbert.com/?p=374</guid>
		<description><![CDATA[What it Does
This tutorial teaches you how to add WordPress 2.8&#8217;s built-in syntax highlighting and line numbering capabilities to your plugins administrative pages. It requires 2.8 beta and up.
Background
WordPress 2.8 is set to be released in the near future and promises to add quite a few new features. Among them, [...]]]></description>
			<content:encoded><![CDATA[<h3>What it Does</h3>
<p>This tutorial teaches you how to add WordPress 2.8&#8217;s built-in syntax highlighting and line numbering capabilities to your plugins administrative pages. It requires 2.8 beta and up.</p>
<h3>Background</h3>
<p>WordPress 2.8 is set to be released in the near future and promises to add quite a few new features. Among them, and one that fellow nerds like me will appreciate, is the addition of syntax highlighting and line numbering to WordPress&#8217; built-in theme and plugin editors. Although I rarely use the built-in editors, it&#8217;s a nice addition for those times I need to make a quick change and don&#8217;t want to log into my FTP.</p>
<p>What made me figure all this out? While developing a plugin recently I found that the user experience would be improved by including syntax highlighting and line numbering. After trying to integrate a few scripts on my own I thought why not try to use WordPress&#8217; built in feature now?</p>
<p>Well, after a few hours of being elbow deep into WordPress&#8217; admin files, here&#8217;s how you can add syntax highlighting and line numbering to your plugin <em>natively</em>. WordPress 2.8 uses an open source project called <a href="http://sourceforge.net/projects/codepress">CodePress</a> to handle the syntax highlighting and we&#8217;re able to tap into that script for our own purposes.</p>
<h3>Download the Tutorial File</h3>
<p>The PHP file is available for you to download, test, and modify: <a class="downloadlink" href="http://www.johnkolbert.com/download/syntaxdemo.zip" title="Version1.0 downloaded 90 times" >WP Syntax Demo (90)</a></p>
<h3>Step 1: Creating Your Plugin&#8217;s Admin Page</h3>
<p>First let&#8217;s create the administrative page for your plugin. For this example I&#8217;ll create a top-level menu page, though you can create your admin page anywhere you like.</p>
<pre class="brush: php;">

function sd_add_pages(){
     add_menu_page('Syntax Demo', 'Syntax Demo', 8, __FILE__, 'sd_content'); //add top level menu page
}

add_action('admin_menu', 'sd_add_pages'); //add options pages
</pre>
<p>First we create the the menu page by using the <em>add_menu_page</em> function and referencing it through the <em>admin_menu</em> action. See the link below for more info on the <em>add_menu_page</em> function.</p>
<p><strong>Useful Link </strong>(opens in new window)<strong>: </strong><a href="http://codex.wordpress.org/Adding_Administration_Menus" target="_blank">Adding Menu Pages &#8211; WP Codex<br />
</a></p>
<h3>Step 2: Creating Your Textbox</h3>
<p>In the <em>add_menu_page</em> function above we referenced a <em>sd_content</em> function. This function will house our textbox that will have the syntax highlighting. First I&#8217;ll give you the code then explain a few important details about it.</p>
<pre class="brush: xml;">

function sd_content(){
?&gt;
   &lt;div class=&quot;wrap&quot;&gt;
     &lt;h2&gt;CodeBox: Test Your Code Here&lt;/h2&gt;

     &lt;form method=&quot;post&quot; action=&quot;&quot; id=&quot;template&quot; name=&quot;template&quot;&gt;
        &lt;table class=&quot;form-table&quot;&gt;
        &lt;tr&gt;
          &lt;td valign=&quot;top&quot; style=&quot;width: 560px&quot;&gt;
            &lt;textarea name=&quot;newcontent&quot; id=&quot;newcontent&quot; tabindex=&quot;1&quot; class=&quot;codepress php&quot; rows=&quot;15&quot; cols=&quot;75&quot;&gt;&lt;?php echo $_POST['newcontent'];?&gt;&lt;/textarea&gt;
             &lt;input style=&quot;margin-top: 10px;&quot; class=&quot;button-primary&quot; type=&quot;submit&quot; value=&quot;submit&quot; /&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
        &lt;/table&gt;
     &lt;/form&gt;
&lt;?php
}
</pre>
<p>This function merely adds a form with the ID of <em>template</em>, and a textarea HTML element with the ID of <em>newcontent</em>. You must use these IDs when naming your textarea and form. To use different IDs see the <em>Advanced Usage </em>section, below. Also, we gave our textarea a special class of <em>class=&#8221;codepress php&#8221;.</em> This tell the CodePress script to change this textbox and that the language we want for syntax highlighting is PHP.</p>
<h3>Step 3: Enqueue the CodePress Script</h3>
<p>In this step we&#8217;ll tell WordPress to add the CodePress script to the list of enqueued scrips that WordPress adds. We&#8217;ll do this by creating a function that calls <em>wp_enqueue_script</em>.</p>
<pre class="brush: php;">

function sd_header(){
     if($_GET['page'] == &quot;syntaxdemo.php&quot;){
          wp_enqueue_script( 'codepress' );
     }
}

add_action('init', 'sd_header'); //add header info
</pre>
<p>To make sure that the CodePress script is only added to the page we need, we&#8217;ll add a simple check to make sure we&#8217;re on our plugin&#8217;s settings page. You&#8217;ll need to adapt the <em>$_GET['page'] == &#8220;syntaxdemo.php&#8221; </em>to reflect the actual filename of your plugin. If you plugin is in a folder it would be <em>$_GET['page'] == &#8220;folder/syntaxdemo.php&#8221;. </em>Also, you&#8217;re <em>$_GET['page']</em> variable may be different depending on how you added your plugin settings page (in our case, as a top-level menu).</p>
<p><strong>Useful Link </strong>(opens in new window)<strong>: </strong> <a target="_blank" href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">Using wp_enqueue_script &#8211; WP Codex</a></p>
<h3>Step 4: Finishing the Textbox Input</h3>
<p>If we stopped now the textbox we created would have proper syntax highlighting and line numbers. However, you wouldn&#8217;t be able to access any of the information that the user enters into the textbox. This is because CodePress actually places an iFrame HTML element over the textbox. Thus all editing is being done in the iFrame and not actually in the textbox we created. We just need to get the value of the textbox from the iFrame and add it to our textbox when the form is submitted.</p>
<p>There are two ways to do this. We can use WordPress&#8217; built in function:</p>
<pre class="brush: php;">

if($_GET['page'] == &quot;syntaxdemo.php&quot;){
      add_action( 'admin_print_footer_scripts', 'codepress_footer_js' );
}
</pre>
<p>However, this <strong>requires</strong> the following</p>
<ul>
<li>form ID and name of <em>template</em></li>
<li>textarea ID and name of <em>newcontent</em></li>
</ul>
<p>If you follow the above guidlines, then this script will work fine. <em>Note: I followed these guidlines in this example</em>.</p>
<h3>Advanced Usage</h3>
<p>If you&#8217;d rather use your own IDs and names for your form and textarea we can manually add the correct javascript code to the footer. This code is the same as got included in the <em>admin_print_footer_scripts</em> function used above, but we&#8217;ll manually change the IDs to reflect our own.</p>
<pre class="brush: php;">

function sd_footer(){
     if($_GET['page'] == &quot;syntaxdemo.php&quot;){
?&gt;  &lt;script type=&quot;text/javascript&quot;&gt;
          /* &lt;![CDATA[ */
          var codepress_path = '&lt;?php echo includes_url('js/codepress/'); ?&gt;';
          jQuery('#formid').submit(function(){
          if (jQuery('#textareaid_cp').length)
          jQuery('#textareaid_cp').val(textareaid.getCode()).removeAttr('disabled');
          });
          /* ]]&gt; */
      &lt;/script&gt;
&lt;?php
     }
}

add_action('admin_footer', 'sd_footer');
</pre>
<p>There are a few noteworthy things in the above code. Here again we checked to make sure we were on our plugin&#8217;s page by using the <em>$_GET['page'] </em>check as we did before. Also, we must change <em>#formid </em>on line 6, above, to the ID we&#8217;ve given our form. If the ID is <em>myform</em>, then it would begin <em>jQuery(&#8216;#myform&#8217;).</em></p>
<p>Finally, we must change <em>#textareaid</em> to reflect the actual ID of the textarea we create, making sure to keep the <em>_cp</em> addition were necessary. If we create a textarea with the ID of <em>mytextarea</em>, lines 7-8 in the above code would get changed to the following:</p>
<pre class="brush: php;">
if (jQuery('#mytextarea_cp').length)
jQuery('#mytextarea_cp').val(mytextarea.getCode()).removeAttr('disabled');
</pre>
<h3>That&#8217;s It</h3>
<p>By following the above instructions we can now include syntax highlighting and line numbering natively in our WordPress plugins. Where could you use this? Some examples might be as custom field boxes on the write post/page screen, or on settings pages for plugins where the user needs to paste or enter some HTML or PHP code. I&#8217;m working on integrating it into a few of my plugins. What about you? Do you think it&#8217;s worth it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnkolbert.com/wordpress/add-native-syntax-highlighting-and-line-numbering-to-your-plugin-with-wp-28/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
