<?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>bavotasan.com &#187; quicktag</title>
	<atom:link href="http://bavotasan.com/tag/quicktag/feed/" rel="self" type="application/rss+xml" />
	<link>http://bavotasan.com</link>
	<description>by c.bavota</description>
	<lastBuildDate>Tue, 07 Feb 2012 15:42:10 +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>Magazine Columns Free WordPress Plugin</title>
		<link>http://bavotasan.com/2009/magazine-columns-wordpress-plugin/</link>
		<comments>http://bavotasan.com/2009/magazine-columns-wordpress-plugin/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 20:05:38 +0000</pubDate>
		<dc:creator>c.bavota</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[Columns]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[html editor]]></category>
		<category><![CDATA[idea]]></category>
		<category><![CDATA[Lt]]></category>
		<category><![CDATA[magazine]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[quicktag]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress plugin]]></category>

		<guid isPermaLink="false">http://bavotasan.com/?p=523</guid>
		<description><![CDATA[I have been spending a lot of time developing my Magazine Basic theme so I guess I have magazines on the brain. While speaking with a colleague, I got the idea to create a plugin that would create columns in posts or pages, similar to a magazine article. Thus, Magazine Columns was created. All you [...]]]></description>
			<content:encoded><![CDATA[<p><a class="highslide" href="http://bavotasan.com/wp-content/uploads/2009/03/screenshot-1.jpg"><img src="http://bavotasan.com/wp-content/uploads/2009/03/screenshot-1-178x200.jpg" alt="screenshot-1" title="screenshot-1" width="178" height="200" class="alignright size-thumbnail wp-image-526" /></a>I have been spending a lot of time developing my <a href="http://bavotasan.com/downloads/magazine-basic-free-wordpress-theme/">Magazine Basic theme</a> so I guess I have magazines on the brain. While speaking with a colleague, I got the idea to create a plugin that would create columns in posts or pages, similar to a magazine article. Thus, Magazine Columns was created.<br />
<span id="more-523"></span><br />
All you need to do is download the plugin and add the <code>&lt;!--column--&gt;</code> tag to your post or page with the column quicktag in the HTML editor or manually. You can create up to five columns.</p>
]]></content:encoded>
			<wfw:commentRss>http://bavotasan.com/2009/magazine-columns-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>102</slash:comments>
		</item>
		<item>
		<title>Adding a Simple Quicktag to the HTML Editor in WordPress</title>
		<link>http://bavotasan.com/2009/adding-a-simple-quicktag-to-the-html-editor-in-wordpress/</link>
		<comments>http://bavotasan.com/2009/adding-a-simple-quicktag-to-the-html-editor-in-wordpress/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 16:01:19 +0000</pubDate>
		<dc:creator>c.bavota</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[document]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[Functionality]]></category>
		<category><![CDATA[html editor]]></category>
		<category><![CDATA[img]]></category>
		<category><![CDATA[line]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[Location]]></category>
		<category><![CDATA[quicktag]]></category>
		<category><![CDATA[span]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[type]]></category>
		<category><![CDATA[var]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://bavotasan.com/?p=158</guid>
		<description><![CDATA[When you are editing a post or writing a new post in WordPress, you might have noticed those buttons above the editing box. They add WYSIWYG type functionality to the WordPress editor for common functions such as bolding, italics and linking. WordPress refers to these buttons as Quicktags. They should look something like this if [...]]]></description>
			<content:encoded><![CDATA[<p>When you are editing a post or writing a new post in WordPress, you might have noticed those buttons above the editing box. They add WYSIWYG type functionality to the WordPress editor for common functions such as bolding, italics and linking. WordPress refers to these buttons as Quicktags.<br />
<span id="more-158"></span><br />
They should look something like this if you use the HTML editor.</p>
<p><a class="highslide" href="http://bavotasan.com/wp-content/uploads/2009/01/quicktags.jpg"><img class="aligncenter size-medium wp-image-159" title="quicktags" src="http://bavotasan.com/wp-content/uploads/2009/01/quicktags-580x32.jpg" alt="quicktags" width="580" height="32" /></a></p>
<p>If you use the Visual editor they should look something like this.</p>
<p><a class="highslide" href="http://bavotasan.com/wp-content/uploads/2009/01/quicktags2.jpg"><img class="aligncenter size-full wp-image-160" title="quicktags2" src="http://bavotasan.com/wp-content/uploads/2009/01/quicktags2.jpg" alt="quicktags2" width="459" height="33" /></a></p>
<p>If you have a function that you use often it is very simple to add it to the Quicktag bar. For this example, I am going to add a button that creates a span tag and asks for a class to the HTML editor Quicktag bar.</p>
<p>The file we need to work with is under <code>wp-includes/js/quicktags.js</code>.</p>
<p>First we need to create the button, so go to around line 36 and enter the following.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>36
37
38
39
40
41
42
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">edButtons<span style="color: #009900;">&#91;</span>edButtons<span style="color: #339933;">.</span>length<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span>
<span style="color: #000000; font-weight: bold;">new</span> edButton<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ed_class'</span>
<span style="color: #339933;">,</span><span style="color: #0000ff;">'span'</span>
<span style="color: #339933;">,</span><span style="color: #0000ff;">''</span>
<span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;/span&gt;'</span>
<span style="color: #339933;">,</span><span style="color: #0000ff;">'p'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// special case</span></pre></td></tr></table></div>

<p>Then we need to add the part that actually makes it call the function that asks the user to enter a class name. Find this part around line 166.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>166
167
168
169
170
171
172
173
174
175
176
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> edShowButton<span style="color: #009900;">&#40;</span>button<span style="color: #339933;">,</span> i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>button<span style="color: #339933;">.</span>id <span style="color: #339933;">==</span> <span style="color: #0000ff;">'ed_img'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
document<span style="color: #339933;">.</span>write<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;input type=&quot;button&quot; id=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>id <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; accesskey=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>access <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; class=&quot;ed_button&quot; onclick=&quot;edInsertImage(edCanvas);&quot; value=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>display <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>button<span style="color: #339933;">.</span>id <span style="color: #339933;">==</span> <span style="color: #0000ff;">'ed_link'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
document<span style="color: #339933;">.</span>write<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;input type=&quot;button&quot; id=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>id <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; accesskey=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>access <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; class=&quot;ed_button&quot; onclick=&quot;edInsertLink(edCanvas, '</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #0000ff;">');&quot; value=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>display <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
document<span style="color: #339933;">.</span>write<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;input type=&quot;button&quot; id=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>id <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; accesskey=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>access <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; class=&quot;ed_button&quot; onclick=&quot;edInsertTag(edCanvas, '</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #0000ff;">');&quot; value=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>display <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot;  /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And make it this.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>166
167
168
169
170
171
172
173
174
175
176
177
178
179
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> edShowButton<span style="color: #009900;">&#40;</span>button<span style="color: #339933;">,</span> i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>button<span style="color: #339933;">.</span>id <span style="color: #339933;">==</span> <span style="color: #0000ff;">'ed_img'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
document<span style="color: #339933;">.</span>write<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;input type=&quot;button&quot; id=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>id <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; accesskey=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>access <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; class=&quot;ed_button&quot; onclick=&quot;edInsertImage(edCanvas);&quot; value=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>display <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>button<span style="color: #339933;">.</span>id <span style="color: #339933;">==</span> <span style="color: #0000ff;">'ed_link'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
document<span style="color: #339933;">.</span>write<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;input type=&quot;button&quot; id=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>id <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; accesskey=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>access <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; class=&quot;ed_button&quot; onclick=&quot;edInsertLink(edCanvas, '</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #0000ff;">');&quot; value=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>display <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>button<span style="color: #339933;">.</span>id <span style="color: #339933;">==</span> <span style="color: #0000ff;">'ed_class'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
document<span style="color: #339933;">.</span>write<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;input type=&quot;button&quot; id=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>id <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; accesskey=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>access <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; class=&quot;ed_button&quot; onclick=&quot;edInsertClass(edCanvas, '</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #0000ff;">');&quot; value=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>display <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
document<span style="color: #339933;">.</span>write<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;input type=&quot;button&quot; id=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>id <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; accesskey=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>access <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot; class=&quot;ed_button&quot; onclick=&quot;edInsertTag(edCanvas, '</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #0000ff;">');&quot; value=&quot;'</span> <span style="color: #339933;">+</span> button<span style="color: #339933;">.</span>display <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot;  /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And it needs one last part, the actual function, to work properly, so go to the end of the file and add this.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>403
404
405
406
407
408
409
410
411
412
413
414
415
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> edInsertClass<span style="color: #009900;">&#40;</span>myField<span style="color: #339933;">,</span> i<span style="color: #339933;">,</span> defaultValue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>defaultValue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
defaultValue <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>edCheckOpenTags<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000000; font-weight: bold;">CLASS</span> <span style="color: #339933;">=</span> prompt<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Enter the Image location'</span> <span style="color: #339933;">,</span>defaultValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">CLASS</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
edButtons<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span>tagStart <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;span class=&quot;'</span> <span style="color: #339933;">+</span> <span style="color: #000000; font-weight: bold;">CLASS</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span> edInsertTag<span style="color: #009900;">&#40;</span>myField<span style="color: #339933;">,</span> i<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: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
edInsertTag<span style="color: #009900;">&#40;</span>myField<span style="color: #339933;">,</span> i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>v <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>When it comes down to it, this might actually be a little bit more complicated of a  Quicktag to create but there you go.</p>
]]></content:encoded>
			<wfw:commentRss>http://bavotasan.com/2009/adding-a-simple-quicktag-to-the-html-editor-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

