<?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>Sean&#039;s Blog &#187; Wordpress</title>
	<atom:link href="http://seanbehan.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanbehan.com</link>
	<description>Web Programming, Ruby on Rails, Wordpress, PHP from Burlington, Vermont</description>
	<lastBuildDate>Wed, 18 Jan 2012 21:44:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Matt Mullenweg is Wrong. Thesis Should Carry Whatever License It Wants.</title>
		<link>http://seanbehan.com/php/matt-mullenweg-is-wrong-thesis-should-carry-whatever-license-it-wants/</link>
		<comments>http://seanbehan.com/php/matt-mullenweg-is-wrong-thesis-should-carry-whatever-license-it-wants/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 02:23:49 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[chris pearson]]></category>
		<category><![CDATA[gpl]]></category>
		<category><![CDATA[legality]]></category>
		<category><![CDATA[matt mullenweg]]></category>
		<category><![CDATA[mixergy]]></category>
		<category><![CDATA[php license]]></category>
		<category><![CDATA[thesis]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1083</guid>
		<description><![CDATA[There is a debate underway about the legality of Thesis, a popular, paid for WordPress theme, using a different license than the one WordPress uses, which is the GPL. Matt Mullenweg, founder of WordPress, contends that all themes for the platform should inherit the WordPress license and should be considered a part of the platform. [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fphp%2Fmatt-mullenweg-is-wrong-thesis-should-carry-whatever-license-it-wants%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Matt Mullenweg is Wrong. Thesis Should Carry Whatever License It Wants." data-url="http://seanbehan.com/php/matt-mullenweg-is-wrong-thesis-should-carry-whatever-license-it-wants/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>There is a debate underway about the legality of <a href="http://diythemes.com/" target="_blank">Thesis</a>, a popular, paid for WordPress theme, using a different license than the one WordPress uses, which is the <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GPL</a>. <a href="http://ma.tt" target="_blank">Matt Mullenweg</a>, founder of <a href="http://wordpress.org" target="_blank">WordPress</a>, contends that all themes for the platform should inherit the WordPress license and should be considered a part of the platform. Chris Pearson, creator of Thesis, obviously has a different opinion. There have been many <a href="http://wordpress.tv/2010/07/15/mixergy-interview-pearson-mullenweg/" target="_blank">heated debates</a> over the topic, but I haven&#8217;t heard an argument by either side that is compelling one way or the other.</p>
<p>My opinion, which I obviously think is compelling, though is not in any way rooted in any facet of the law or articulated in any legalese whatsoever, is that Matt Mullenweg is wrong. I love what Matt has done. I use and love the WordPress platform. I also think that his position is noble and rooted in the greater good for the WordPress community and open source in general.</p>
<p>I think what has been overlooked in his argument is an assumption we have about software, namely how it is supposed to work and what defines working software in relation to a pluggable software stack, such as WordPress. Technically, I could create an empty my-new-index.php file, place it inside the WordPress directory structure, and I have extended the platform. According to Matt, my software which does nothing, must inherit the WordPress license. Now if I want to sell (or redistribute) this do nothing piece of software for $50.00 (<a href="mailto:bseanvt@gmail.com?subject=send-me-my-50-dollar-index-file">available upon request</a>) I must also sell it with the GPL license. So technically, any piece of PHP code can placed inside of the WordPress directory structure and therefore, all PHP code must also carry the WordPress license!?!</p>
<p>There is obviously some rational limit and discretion available to us so that this sort of thing won&#8217;t ever happen!  We could say because the Thesis theme makes use of the WordPress API, it must be intended for use with WordPress. However, the WordPress API is a bunch of PHP functions and WordPress  itself uses the PHP API, which carries a different license (<a href="http://www.php.net/license/3_01.txt" target="_blank">The PHP License</a>). Which one takes precedence (if they were conflicting) ? Do all PHP applications, because they all must, by definition, use the PHP API, have to inherit the PHP License? This would be ridiculous and I&#8217;ve never seen a PHP app with the PHP license, so clearly using an API can&#8217;t include licensing requirements, so long as you aren&#8217;t modifying and redistributing the original API itself. For example, if I use a PEAR class, I don&#8217;t have to inherit the license for all of my work, I just can&#8217;t change the license of that class and or modify the original code without making it available again.  Thesis doesn&#8217;t (to my knowledge) modify or extend any of the WordPress core. It provides interface enhancements, outputted HTML generated not by WordPress, but by Thesis. WordPress just consumes the Thesis software because it exists in a certain location, placed by someone into the WordPress directory structure.</p>
<p>This is the nature of pluggable systems, or software stacks. They are meant to be interoperable with other pieces of software whose parts and purposes are not known ahead of time. This covers a lot of space, space that isn&#8217;t even in existence and which it would, if Matt were correct, claim licensing rights to, in the event &#8220;it&#8221; comes into existence and &#8220;works&#8221; with said piece of software. Clearly Thesis &#8220;works&#8221; with WordPress. But so does a blank file. I intend for that file to do nothing, and it performs (quite efficiently) that task!</p>
<p>At the end of the day, it is only because Thesis is marketed to the WordPress community and is intended to be used with the WordPress platform, that there is an argument about how the software should be licensed. But Thesis is not sold bundled with WordPress, nor is anyone who purchases it required to use it with WordPress. For all intents and purposes, it is a stand alone piece of code, that well, does nothing important or worthwhile. Can you really license functionality that may or may not exist depending on how the purchaser decides to implement their purchase, just like my overpriced(though well worth the investment), blank PHP file could be used in any PHP application?</p>
<p>I have a lot of questions (I haven&#8217;t read all the licenses either, so I may be in total error :). Though from what I&#8217;ve read and heard so far, it is only because we have an expectation of how the software will work when it is in the WordPress directory structure that there is a conflict with how Chris has licensed Thesis. This expectation is set by the marketing of the software, not necessarily the software itself. Aside from Trademark infringement, does the language used to sell a product carry over into the the actual license the code must carry? This wouldn&#8217;t make sense. Say for instance, &#8220;Runs on Windows&#8221;, would require another license too?</p>
<p>I think we&#8217;re going to see a lot more arguments over licensing conflicts like what we&#8217;re seeing with WordPress/Thesis. Software is the biggest it has ever been. Open Source software is integrated into the business world like never before and business models are built on top of many of the various projects which are out there, &#8220;free&#8221; to use. As this space expands, no doubt more and more gray areas will as well.</p>
<p>On a practical note, what would stop Chris from writing a simple wrapper  around the WordPress API his files use, license this with the GPL, use  his wrapper functions instead from inside Thesis and then keep the  current Thesis license?</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/php/matt-mullenweg-is-wrong-thesis-should-carry-whatever-license-it-wants/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Import/Export Your WordPress Blogroll&#8230; er, Your Links</title>
		<link>http://seanbehan.com/programming/how-to-importexport-your-wordpress-blogroll-er-your-links/</link>
		<comments>http://seanbehan.com/programming/how-to-importexport-your-wordpress-blogroll-er-your-links/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 17:15:35 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[lynx]]></category>
		<category><![CDATA[opml]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1079</guid>
		<description><![CDATA[It&#8217;s not immediately apparent how to import/export the links in your WordPress blogroll. One would expect that the import/export tool, used to backup/restore WordPress posts and pages would handle this functionality as well. But the import/export tool has many options. You need to select the Blogroll import option (located near the top of the list) [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fprogramming%2Fhow-to-importexport-your-wordpress-blogroll-er-your-links%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="How to Import/Export Your WordPress Blogroll&#8230; er, Your Links" data-url="http://seanbehan.com/programming/how-to-importexport-your-wordpress-blogroll-er-your-links/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>It&#8217;s not immediately apparent how to import/export the links in your WordPress blogroll. One would expect that the import/export tool, used to backup/restore WordPress posts and pages would handle this functionality as well. But the import/export tool has many options. You need to select the Blogroll import option (located near the top of the list) and provide the tool with either the destination of a valid OPML XML url, or upload a valid OPML XML file. If you&#8217;re running on WordPress, this can be found by appending a &#8220;/wp-links-opml.php&#8221; to the URL of your domain. For example, http://seanbehan.com/wp-links-opml.php will show you my blogroll in XML. If your running out of a subdirectory, don&#8217;t forget to include that path in the URL.</p>
<p>If for some reason you&#8217;re running a development website on your localhost, obviously the live, remote site will not be able to contact your localhost for the data. You will have to upload the XML file to the remote site. The WordPress export tool does not provide the means to generate a the OPML XML file for you. You will have to visit the /wp-links-opml.php file and download the contents yourself, but this depends on how your browser handles XML files. Firefox will show you the raw XML, however, Safari will show you the contents of the XML nodes&#8230; which will most likely be only the name of your website. You&#8217;ll need to go to &#8220;View Source&#8221; option to see the actual XML code.Copy and past the XML to a file with the .xml file extension somewhere on your hard drive. Visit the import &gt; blogroll tool and upload the file!</p>
<p>A simple way to download the file contents is to use the command line web browser Lynx. <a href="http://en.wikipedia.org/wiki/Lynx_%28web_browser%29" target="_blank">http://en.wikipedia.org/wiki/Lynx_%28web_browser%29</a></p>
<p>Just give Lynx the destination URL and the file to write to (it doesn&#8217;t have to exist) and then you can upload this file</p>
<p>&lt;pre&gt;</p>
<p>lynx -source URL &gt; my-links.xml</p>
<p>&lt;/pre&gt;</p>
<p>More info on lynx available here: <a href="http://kb.iu.edu/data/aczi.html" target="_blank">http://kb.iu.edu/data/aczi.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/programming/how-to-importexport-your-wordpress-blogroll-er-your-links/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Get Child Categories of Parent Category on Single Post in WordPress</title>
		<link>http://seanbehan.com/programming/get-child-categories-of-parent-category-on-single-post-in-wordpress/</link>
		<comments>http://seanbehan.com/programming/get-child-categories-of-parent-category-on-single-post-in-wordpress/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 15:51:26 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[children]]></category>
		<category><![CDATA[functionality]]></category>
		<category><![CDATA[get_categories]]></category>
		<category><![CDATA[parent]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1056</guid>
		<description><![CDATA[I was hoping to find a function in the WordPress API, that goes something like this&#8230; the_child_categories(&#34;Vermont&#34;); // print Burlington, Brattleboro... etc if this post has any child categories of Vermont But I could not. The result that I did find, from various forums goes something like this&#8230; $parentcat = get_category_by_slug('Vermont'); foreach((get_the_category()) as $childcat): if [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fprogramming%2Fget-child-categories-of-parent-category-on-single-post-in-wordpress%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Get Child Categories of Parent Category on Single Post in WordPress" data-url="http://seanbehan.com/programming/get-child-categories-of-parent-category-on-single-post-in-wordpress/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I was hoping to find a function in the WordPress API, that goes something like this&#8230;</p>
<pre class="wp-code-highlight prettyprint">
  the_child_categories(&quot;Vermont&quot;);
  // print Burlington, Brattleboro... etc if this post has any child categories of Vermont
</pre>
<p>But I could not. The result that I did find, from various forums goes something like this&#8230;</p>
<pre class="wp-code-highlight prettyprint">
$parentcat = get_category_by_slug('Vermont');
foreach((get_the_category()) as $childcat):
  if (cat_is_ancestor_of($parentcat, $childcat)):
    echo get_category_link($childcat-&gt;cat_ID);
    echo $childcat-&gt;cat_name;
  endif;
endforeach;
</pre>
<p>If you&#8217;re in the in the Loop, you can use the get_the_category() function to retrieve the category objects of the current post, without printing the results to the screen. You can loop over the contents from what is returned by the function.</p>
<p>This condition uses the API function &#8220;cat_is_ancestor_of&#8221; to check whether or not the category from the current post is a child of the parent which we fetched with the &#8220;get_category_by_slug&#8221; function.</p>
<p>Here is a little function that I threw into &#8220;functions.php&#8221; so that I can get the child categories easily in my theme.</p>
<pre class="wp-code-highlight prettyprint">
/** Usage
_the_category_children(&quot;Vermont&quot;); */
function _the_category_children($slug=&quot;&quot;){
  if($categories       = get_the_category()):
    if($slug_category   = get_category_by_slug($slug)):
      foreach($categories as $category):
        echo (cat_is_ancestor_of($slug_category, $category)) ? $category-&gt;cat_name : '';
      endforeach;
    endif;
  endif;
}
</pre>
<p>More info/references on accomplishing this functionality are available<br />
<a href="http://codex.wordpress.org/Function_Reference/cat_is_ancestor_of">http://codex.wordpress.org/Function_Reference/cat_is_ancestor_of</a><br />
<a href="http://wordpress.org/support/topic/284057?replies=8#post-1120489">http://wordpress.org/support/topic/284057?replies=8#post-1120489</a><br />
<a href="http://wordpress.org/support/topic/297615">http://wordpress.org/support/topic/297615</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/programming/get-child-categories-of-parent-category-on-single-post-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How To Flush Your Permalink Structure in WordPress When Using Taxonomies &#8230;or WordPress Taxonomies Not Working Instead I See A 404 Page</title>
		<link>http://seanbehan.com/programming/how-to-flush-your-permalink-structure-in-wordpress-when-using-taxonomies-or-wordpress-taxonomies-not-working-instead-i-see-a-404-page/</link>
		<comments>http://seanbehan.com/programming/how-to-flush-your-permalink-structure-in-wordpress-when-using-taxonomies-or-wordpress-taxonomies-not-working-instead-i-see-a-404-page/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 17:08:14 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[permalinks]]></category>
		<category><![CDATA[taxonomies]]></category>
		<category><![CDATA[taxonomy]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1051</guid>
		<description><![CDATA[I didn&#8217;t know this, but because of a linking problem using custom taxonomies in WordPress, I was forced to find out. If you create a new taxonomy, it will not work immediately on the front facing end. Your users will be greeted by a 404, page not found instead. This isn&#8217;t ideal for obvious reasons. [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fprogramming%2Fhow-to-flush-your-permalink-structure-in-wordpress-when-using-taxonomies-or-wordpress-taxonomies-not-working-instead-i-see-a-404-page%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="How To Flush Your Permalink Structure in WordPress When Using Taxonomies &#8230;or WordPress Taxonomies Not Working Instead I See A 404 Page" data-url="http://seanbehan.com/programming/how-to-flush-your-permalink-structure-in-wordpress-when-using-taxonomies-or-wordpress-taxonomies-not-working-instead-i-see-a-404-page/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I didn&#8217;t know this, but because of a linking problem using custom taxonomies in WordPress, I was forced to find out. If you create a new taxonomy, it will not work immediately on the front facing end. Your users will be greeted by a 404, page not found instead. This isn&#8217;t ideal for obvious reasons.</p>
<p>You create and/or register custom taxonomies like so. You may have multiple taxonomies.</p>
<pre class="wp-code-highlight prettyprint">
add_action('init', 'create_my_taxonomy', 0);
function create_my_taxonomy(){
  register_taxonomy( 'musicians',
    'post',
    array(
      'hierarchical' =&gt; false,
      'label' =&gt; 'People who play lovely music that I like...',
      'query_var' =&gt; 'musicians',
      'rewrite' =&gt; array('slug'=&gt;'musicians')
    )
  );
}
</pre>
<p>In your theme directory you need at &#8220;taxonomy.php&#8221; file. This will catch your custom taxonomy requests. You can get even more fancy and create a file like so &#8220;taxonomy-musicians.php&#8221; which you can use to differentiate your taxonomies look/feel. Nice and slick&#8230; however, you may be frustrated after following these two steps and be greeted with a friendly 404 page not found template instead.</p>
<p>Fear not, you need only visit the Admin >> Settings >> Permalinks page as a logged in admin to flush your rewrite rules and get linking and your correct custom taxonomy template file. Straight forward, unless if you didn&#8217;t know that merely visiting the Permalinks Settings page would correct the problem. But Alas, you do!</p>
<h1><em>Addendum</em></h1>
<p>You must also have posts using the taxonomy! Otherwise, you will still get the page 404 not found! I&#8217;m not sure if there is a work around for this at the moment. Anyone know?</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/programming/how-to-flush-your-permalink-structure-in-wordpress-when-using-taxonomies-or-wordpress-taxonomies-not-working-instead-i-see-a-404-page/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>TinyMCE Rich Text Editor: HELLO EDITOR Plugin Tutorial and Example</title>
		<link>http://seanbehan.com/wordpress/tinymce-rich-text-editor-hello-editor-plugin-tutorial-and-example/</link>
		<comments>http://seanbehan.com/wordpress/tinymce-rich-text-editor-hello-editor-plugin-tutorial-and-example/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 19:26:52 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[text editor]]></category>
		<category><![CDATA[tinymce]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=598</guid>
		<description><![CDATA[I wanted to create a button for the TinyMCE Rich Text Editor for WordPress. It was tough to find good docs on the subject. There are a couple of useful posts out there but in general I found them lacking. http://codex.wordpress.org/TinyMCE_Custom_Buttons#Creating_an_MCE_Editor_Plugin The above resource has a good section on the PHP code needed to write [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fwordpress%2Ftinymce-rich-text-editor-hello-editor-plugin-tutorial-and-example%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="TinyMCE Rich Text Editor: HELLO EDITOR Plugin Tutorial and Example" data-url="http://seanbehan.com/wordpress/tinymce-rich-text-editor-hello-editor-plugin-tutorial-and-example/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I wanted to create a button for the TinyMCE Rich Text Editor for WordPress. It was tough to find good docs on the subject. There are a couple of useful posts out there but in general I found them lacking.<br />
<a href=" http://codex.wordpress.org/TinyMCE_Custom_Buttons#Creating_an_MCE_Editor_Plugin"></p>
<p>http://codex.wordpress.org/TinyMCE_Custom_Buttons#Creating_an_MCE_Editor_Plugin</a></p>
<p>The above resource has a good section on the PHP code needed to write your own callbacks but there is no mention of the JavaScript required to create a button and interact with it. Links are available for more reading but why not also post a code sample to get up and running?</p>
<p>Anyway, I made a simple plugin after hobbling a bunch of resources together to get a button in the text editor that when clicked triggers an alert to the window. The code isn&#8217;t fancy but it might provide a starting off point for a larger project or be useful as a resource for some of the basic ideas involved. I read through a couple of the sample plugins included with WordPress along with the Viper Video Quicktags Plugin, which makes extensive use of the feature. However, they were too complex for a quick, basic understanding.</p>
<p>This plugin doesn&#8217;t do a lot. I&#8217;ll probably flesh it out a bit more when I have a clearer understanding of how it all works. For now here are some code samples and at the bottom of this post there is a link to the .zip file for the plugin which you can install on your own site.</p>
<p>In wp-content/plugins/hello_editor/index.php</p>
<pre class="wp-code-highlight prettyprint">&amp;lt;?php
/*
Plugin Name: Hello Editor
Plugin URI: http://seanbehan.com/wordpress/tinymce-rich-text-editor-hello-editor-plugin-tutorial-and-example/
Description: A simple plugin showing how to add a button to the rich text editor in WordPress.
The plugin doesn't do anything except place a button and respond to onclick event, with &quot;Hello Editor&quot;.
Most of the editor plugins available are too 'functional' to quickly read and see how to do the
basics. This plugin doesn't 'do' anything, rather it makes it simple to read what is going on.
Version: 0.1
Author: Sean Behan
Author URI: http://seanbehan.com
*/

define( &quot;HELLO_EDITOR_PLUGIN_DIR&quot;, &quot;hello_editor&quot; );
define( &quot;HELLO_EDITOR_PLUGIN_URL&quot;, &quot;/wp-content/plugins/&quot; . HELLO_EDITOR_PLUGIN_DIR );

// Register the external pllugin from the .js file
function hello_editor_register_external_plugin($plugin_array) {
  $plugin_array['HELLO_EDITOR'] = HELLO_EDITOR_PLUGIN_URL . '/editor_plugin.js';
  return $plugin_array;
}

// Add the button to the array ***NOTE*** The name here &quot;HELLO_EDITOR&quot; must
//match the name in the editor plugin file for the addButton(name_of_button) function!
function hello_editor_register_button($buttons) {
  array_push( $buttons, &quot;|&quot;, &quot;HELLO_EDITOR&quot; );
  return $buttons;
}

// Filters which will call our functions
function hello_editor_init(){
  add_filter(&quot;mce_external_plugins&quot;, &quot;hello_editor_register_external_plugin&quot;);
  add_filter('mce_buttons', 'hello_editor_register_button');
}

// When the editor is initialized
add_action('init', 'hello_editor_init');</pre>
<p>In wp-content/plugins/hello_editor/editor_plugin.js</p>
<pre class="wp-code-highlight prettyprint">(function() {
  //Init the plugin
  tinymce.create('tinymce.plugins.HELLO_EDITOR', {
    init : function( ed, url ) {
    //addButton name needs to match $plugin_array['HELLO_EDITOR'] in add_filter function
    ed.addButton('HELLO_EDITOR', {
      title : 'Hello Editor',
      image : url + &quot;/buttons/hello.png&quot;,
      onclick : function(){
        alert(&quot;HELLO EDITOR!&quot;);
      }
    });
  },
  //Info about the plugin
  getInfo : function() {
    return {
      longname : &quot;Sean Behan's Sample Hello Editor Plugin&quot;,
      author : 'Sean Behan',
      authorurl : 'http://www.seanbehan.com/',
      infourl : 'http://seanbehan.com/wordpress/tinymce-rich-text-editor-hello-editor-plugin-tutorial-and-example/',
      version : &quot;0.1&quot;
    };
  }
});
tinymce.PluginManager.add('HELLO_EDITOR', tinymce.plugins.HELLO_EDITOR);
})();</pre>
<p>You&#8217;ll also need a directory called buttons inside the hello_editor plugin directory with a hello.png file which will be displayed. Without it you&#8217;ll just get a blank button. You can rename this but remember to change the name in the editor_plugin.js file as well.</p>
<p>You can download the sample plugin here <a href="http://seanbehan.com/wp-content/uploads/2009/11/hello_editor.zip">http://seanbehan.com/wp-content/uploads/2009/11/hello_editor.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/wordpress/tinymce-rich-text-editor-hello-editor-plugin-tutorial-and-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

