<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments for bavotasan.com</title>
	<atom:link href="http://bavotasan.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://bavotasan.com</link>
	<description>by c.bavota</description>
	<lastBuildDate>Thu, 02 Feb 2012 18:40:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comment on Create a Black &amp; White Thumbnail in WordPress by Ralph</title>
		<link>http://bavotasan.com/2011/create-black-white-thumbnail-wordpress/comment-page-2/#comment-32974</link>
		<dc:creator>Ralph</dc:creator>
		<pubDate>Thu, 02 Feb 2012 18:40:59 +0000</pubDate>
		<guid isPermaLink="false">http://bavotasan.com/?p=3641#comment-32974</guid>
		<description>It just does not work.

Block of code #1 and #2 in functions.php file wrapped in php tags near the end of the file.

Block of code #3 in loop.php file wrapped in php tags at the end of the file.

I do not see get_post_thumbnail() anywhere in the loop.

CSS block of code in style.css file.

No B&amp;W images are being created.



If I strip everything and use Otto&#039;s plugin I get a B&amp;W image but when hovered over no effect.</description>
		<content:encoded><![CDATA[<p>It just does not work.</p>
<p>Block of code #1 and #2 in functions.php file wrapped in php tags near the end of the file.</p>
<p>Block of code #3 in loop.php file wrapped in php tags at the end of the file.</p>
<p>I do not see get_post_thumbnail() anywhere in the loop.</p>
<p>CSS block of code in style.css file.</p>
<p>No B&amp;W images are being created.</p>
<p>If I strip everything and use Otto&#8217;s plugin I get a B&amp;W image but when hovered over no effect.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Create a Black &amp; White Thumbnail in WordPress by c.bavota</title>
		<link>http://bavotasan.com/2011/create-black-white-thumbnail-wordpress/comment-page-2/#comment-32973</link>
		<dc:creator>c.bavota</dc:creator>
		<pubDate>Thu, 02 Feb 2012 16:05:18 +0000</pubDate>
		<guid isPermaLink="false">http://bavotasan.com/?p=3641#comment-32973</guid>
		<description>You didn&#039;t follow the last instruction. The display thumbs code needs to go within your WordPress loop, not in the functions.php file. Most themes use a file called loop.php but some might use content.php.</description>
		<content:encoded><![CDATA[<p>You didn&#8217;t follow the last instruction. The display thumbs code needs to go within your WordPress loop, not in the functions.php file. Most themes use a file called loop.php but some might use content.php.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Increase Max Upload File Size in WordPress by c.bavota</title>
		<link>http://bavotasan.com/2012/increase-max-upload-file-size-in-wordpress/comment-page-1/#comment-32972</link>
		<dc:creator>c.bavota</dc:creator>
		<pubDate>Thu, 02 Feb 2012 16:02:26 +0000</pubDate>
		<guid isPermaLink="false">http://bavotasan.com/?p=3764#comment-32972</guid>
		<description>I needed to do this so a client could upload large PDF files but it isn&#039;t a change that most people would want to do.</description>
		<content:encoded><![CDATA[<p>I needed to do this so a client could upload large PDF files but it isn&#8217;t a change that most people would want to do.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Create a Black &amp; White Thumbnail in WordPress by Ralph</title>
		<link>http://bavotasan.com/2011/create-black-white-thumbnail-wordpress/comment-page-2/#comment-32964</link>
		<dc:creator>Ralph</dc:creator>
		<pubDate>Thu, 02 Feb 2012 02:02:58 +0000</pubDate>
		<guid isPermaLink="false">http://bavotasan.com/?p=3641#comment-32964</guid>
		<description>I can not for the life of me to get this to work.
FYI, I am not a programmer.

I appreciate your help.



Do I need to add this somewhere?

add_image_size()



I&#039;m not sure how to place this in the loop.php file

get_post_thumbnail()



I put the CSS in the Custom CSS area.



I placed this in my functions.php file between php tags
&lt;pre lang=&quot;php&quot;&gt;
//Create Thumb
add_action(&#039;after_setup_theme&#039;,&#039;bw_images_size&#039;);
function bw_images_size() {
	$crop = get_option(&#039;thumbnail_crop&#039;)==1 ? true : false;
	add_image_size(&#039;thumbnail-bw&#039;, get_option(&#039;thumbnail_size_w&#039;), get_option(&#039;thumbnail_size_h&#039;), $crop);
}

//Create B&amp;W Thumb
add_filter(&#039;wp_generate_attachment_metadata&#039;,&#039;bw_images_filter&#039;);
function bw_images_filter($meta) {
	$file = wp_upload_dir();
	$file = trailingslashit($file[&#039;path&#039;]).$meta[&#039;sizes&#039;][&#039;thumbnail-bw&#039;][&#039;file&#039;];
	list($orig_w, $orig_h, $orig_type) = @getimagesize($file);
	$image = wp_load_image($file);
	imagefilter($image, IMG_FILTER_GRAYSCALE);
	//imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR);
	switch ($orig_type) {
		case IMAGETYPE_GIF:
			$file = str_replace(&quot;.gif&quot;, &quot;-bw.gif&quot;, $file);
			imagegif( $image, $file );
			break;
		case IMAGETYPE_PNG:
			$file = str_replace(&quot;.png&quot;, &quot;-bw.png&quot;, $file);
			imagepng( $image, $file );
			break;
		case IMAGETYPE_JPEG:
			$file = str_replace(&quot;.jpg&quot;, &quot;-bw.jpg&quot;, $file);
			imagejpeg( $image, $file );
			break;
	}
	return $meta;
}


// Display Thumbs
if(function_exists(&#039;has_post_thumbnail&#039;) &amp;&amp; has_post_thumbnail()) { 
	echo &#039;&lt;a href=&quot;&#039;.get_permalink().&#039;&quot;&gt;&#039;;
	the_post_thumbnail(&#039;thumbnail-bw&#039;, array(&#039;class&#039;=&gt;&#039;fade-image-a&#039;));
	the_post_thumbnail(&#039;thumbnail&#039;, array(&#039;class&#039;=&gt;&#039;fade-image-b&#039;));
	echo &#039;&lt;/a&gt;&#039;;
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I can not for the life of me to get this to work.<br />
FYI, I am not a programmer.</p>
<p>I appreciate your help.</p>
<p>Do I need to add this somewhere?</p>
<p>add_image_size()</p>
<p>I&#8217;m not sure how to place this in the loop.php file</p>
<p>get_post_thumbnail()</p>
<p>I put the CSS in the Custom CSS area.</p>
<p>I placed this in my functions.php file between php tags</p>

<div class="wp_syntax"><table border='0' cellpadding='0' cellspacing='0'><tr><td><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Create Thumb</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'after_setup_theme'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'bw_images_size'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> bw_images_size<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$crop</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thumbnail_crop'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span> ? <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	add_image_size<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thumbnail-bw'</span><span style="color: #339933;">,</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thumbnail_size_w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thumbnail_size_h'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$crop</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Create B&amp;amp;W Thumb</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_generate_attachment_metadata'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'bw_images_filter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> bw_images_filter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$meta</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> wp_upload_dir<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> trailingslashit<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'path'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$meta</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sizes'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'thumbnail-bw'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$orig_w</span><span style="color: #339933;">,</span> <span style="color: #000088;">$orig_h</span><span style="color: #339933;">,</span> <span style="color: #000088;">$orig_type</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">getimagesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$image</span> <span style="color: #339933;">=</span> wp_load_image<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">imagefilter</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> IMG_FILTER_GRAYSCALE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR);</span>
	<span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$orig_type</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">case</span> IMAGETYPE_GIF<span style="color: #339933;">:</span>
			<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.gif&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-bw.gif&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">imagegif</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">case</span> IMAGETYPE_PNG<span style="color: #339933;">:</span>
			<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.png&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-bw.png&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">imagepng</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">case</span> IMAGETYPE_JPEG<span style="color: #339933;">:</span>
			<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.jpg&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-bw.jpg&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">imagejpeg</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$meta</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// Display Thumbs</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'has_post_thumbnail'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> has_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span><span style="color: #339933;">.</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
	the_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thumbnail-bw'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'class'</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #0000ff;">'fade-image-a'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	the_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thumbnail'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'class'</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #0000ff;">'fade-image-b'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></td></tr></table></div>

]]></content:encoded>
	</item>
	<item>
		<title>Comment on Increase Max Upload File Size in WordPress by Web Design Preston</title>
		<link>http://bavotasan.com/2012/increase-max-upload-file-size-in-wordpress/comment-page-1/#comment-32962</link>
		<dc:creator>Web Design Preston</dc:creator>
		<pubDate>Wed, 01 Feb 2012 21:32:57 +0000</pubDate>
		<guid isPermaLink="false">http://bavotasan.com/?p=3764#comment-32962</guid>
		<description>It&#039;s defiantly worth mentioning that many hosts wont allow you to create a php.ini file if your a shared hosting. Also I&#039;m not sure I like the idea of people being able to upload more than 8 meg. I personally cant see any genuine reason as it will only cause issues to end users.</description>
		<content:encoded><![CDATA[<p>It&#8217;s defiantly worth mentioning that many hosts wont allow you to create a php.ini file if your a shared hosting. Also I&#8217;m not sure I like the idea of people being able to upload more than 8 meg. I personally cant see any genuine reason as it will only cause issues to end users.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Introducing Abby by RG</title>
		<link>http://bavotasan.com/2011/introducing-abby/comment-page-1/#comment-32945</link>
		<dc:creator>RG</dc:creator>
		<pubDate>Tue, 31 Jan 2012 11:25:36 +0000</pubDate>
		<guid isPermaLink="false">http://bavotasan.com/?p=3768#comment-32945</guid>
		<description>Oh! Congratulations! She&#039;s sweeeeet</description>
		<content:encoded><![CDATA[<p>Oh! Congratulations! She&#8217;s sweeeeet</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Introducing Abby by Podiz</title>
		<link>http://bavotasan.com/2011/introducing-abby/comment-page-1/#comment-32944</link>
		<dc:creator>Podiz</dc:creator>
		<pubDate>Tue, 31 Jan 2012 10:51:57 +0000</pubDate>
		<guid isPermaLink="false">http://bavotasan.com/?p=3768#comment-32944</guid>
		<description>Congratulations! Just came across this wonderful news! Being a father of a 2 year I know how hectic life is going to be with the arrival of the sweet litl one! Enjoy the moments!</description>
		<content:encoded><![CDATA[<p>Congratulations! Just came across this wonderful news! Being a father of a 2 year I know how hectic life is going to be with the arrival of the sweet litl one! Enjoy the moments!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Increase Max Upload File Size in WordPress by AR</title>
		<link>http://bavotasan.com/2012/increase-max-upload-file-size-in-wordpress/comment-page-1/#comment-32321</link>
		<dc:creator>AR</dc:creator>
		<pubDate>Sat, 28 Jan 2012 03:26:42 +0000</pubDate>
		<guid isPermaLink="false">http://bavotasan.com/?p=3764#comment-32321</guid>
		<description>Thanks. I also have been banging my head against the wall trying to figure this out.</description>
		<content:encoded><![CDATA[<p>Thanks. I also have been banging my head against the wall trying to figure this out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Simple Textarea Word Counter jQuery Plugin by Phil Rae</title>
		<link>http://bavotasan.com/2011/simple-textarea-word-counter-jquery-plugin/comment-page-1/#comment-32301</link>
		<dc:creator>Phil Rae</dc:creator>
		<pubDate>Sat, 28 Jan 2012 01:01:47 +0000</pubDate>
		<guid isPermaLink="false">http://bavotasan.com/?p=3707#comment-32301</guid>
		<description>Hi, me again.  I just realise that when you reload a page with a textarea already populated with text, it doesn&#039;t show the current &#039;words left&#039; until you start typing.  Therefore I&#039;ve amended the plugin slightly so that if the field is not empty on page load, it performs the word count check, just as you have on keyup.  Edit below...

&lt;pre lang=&quot;php&quot;&gt;
(function($){
	$.fn.textareaCounter = function(options) {
		// setting the defaults
		// $(&quot;textarea&quot;).textareaCounter({ limit: 100 });
		var defaults = {
			limit: 100
		};	
		var options = $.extend(defaults, options);
 
		// and the plugin begins
		return this.each(function() {
			var obj, text, wordcount, limited;
 
			obj = $(this);

			obj.after(&#039;Max. &#039;+options.limit+&#039; words&#039;);
			
			// function to check word count in field			
			var countcheck = function() {
		    text = obj.val();
		    if(text === &quot;&quot;) {
		    	wordcount = 0;
		    } else {
			    wordcount = $.trim(text).split(&quot; &quot;).length;
				}
		    if(wordcount &gt;= options.limit) {
		      obj.parent().find(&quot;.counter-text&quot;).html(&#039;0 words left&#039;);
					limited = $.trim(text).split(&quot; &quot;, options.limit);
					limited = limited.join(&quot; &quot;);
					$(this).val(limited);
		    } else {
		      obj.parent().find(&quot;.counter-text&quot;).html((options.limit - wordcount)+&#039; words left&#039;);
		    } 
			}
			
			// if field is not empty, count words
			if(obj.val() != &#039;&#039;) {
				countcheck(); }
 
 			// if field changes, count words
			obj.keyup(function() {
				countcheck(); });
		});
	};
})(jQuery);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi, me again.  I just realise that when you reload a page with a textarea already populated with text, it doesn&#8217;t show the current &#8216;words left&#8217; until you start typing.  Therefore I&#8217;ve amended the plugin slightly so that if the field is not empty on page load, it performs the word count check, just as you have on keyup.  Edit below&#8230;</p>

<div class="wp_syntax"><table border='0' cellpadding='0' cellspacing='0'><tr><td><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #000000; 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: #339933;">.</span>fn<span style="color: #339933;">.</span>textareaCounter <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// setting the defaults</span>
		<span style="color: #666666; font-style: italic;">// $(&quot;textarea&quot;).textareaCounter({ limit: 100 });</span>
		<span style="color: #000000; font-weight: bold;">var</span> defaults <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
			limit<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>	
		<span style="color: #000000; font-weight: bold;">var</span> options <span style="color: #339933;">=</span> $<span style="color: #339933;">.</span>extend<span style="color: #009900;">&#40;</span>defaults<span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// and the plugin begins</span>
		<span style="color: #b1b100;">return</span> this<span style="color: #339933;">.</span><span style="color: #990000;">each</span><span style="color: #009900;">&#40;</span><span style="color: #000000; 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: #000000; font-weight: bold;">var</span> obj<span style="color: #339933;">,</span> text<span style="color: #339933;">,</span> wordcount<span style="color: #339933;">,</span> limited<span style="color: #339933;">;</span>
&nbsp;
			obj <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>this<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			obj<span style="color: #339933;">.</span>after<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Max. '</span><span style="color: #339933;">+</span>options<span style="color: #339933;">.</span>limit<span style="color: #339933;">+</span><span style="color: #0000ff;">' words'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// function to check word count in field			</span>
			<span style="color: #000000; font-weight: bold;">var</span> countcheck <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		    text <span style="color: #339933;">=</span> obj<span style="color: #339933;">.</span>val<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>text <span style="color: #339933;">===</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		    	wordcount <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			    wordcount <span style="color: #339933;">=</span> $<span style="color: #339933;">.</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>length<span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
		    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>wordcount <span style="color: #339933;">&gt;=</span> options<span style="color: #339933;">.</span>limit<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		      obj<span style="color: #339933;">.</span>parent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>find<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.counter-text&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>html<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'0 words left'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					limited <span style="color: #339933;">=</span> $<span style="color: #339933;">.</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> options<span style="color: #339933;">.</span>limit<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					limited <span style="color: #339933;">=</span> limited<span style="color: #339933;">.</span><span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					$<span style="color: #009900;">&#40;</span>this<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>val<span style="color: #009900;">&#40;</span>limited<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>
		      obj<span style="color: #339933;">.</span>parent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>find<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.counter-text&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>html<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>options<span style="color: #339933;">.</span>limit <span style="color: #339933;">-</span> wordcount<span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">' words left'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #009900;">&#125;</span> 
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// if field is not empty, count words</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>obj<span style="color: #339933;">.</span>val<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				countcheck<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
 			<span style="color: #666666; font-style: italic;">// if field changes, count words</span>
			obj<span style="color: #339933;">.</span>keyup<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				countcheck<span style="color: #009900;">&#40;</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: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></td></tr></table></div>

]]></content:encoded>
	</item>
	<item>
		<title>Comment on Simple Textarea Word Counter jQuery Plugin by Phil Rae</title>
		<link>http://bavotasan.com/2011/simple-textarea-word-counter-jquery-plugin/comment-page-1/#comment-32298</link>
		<dc:creator>Phil Rae</dc:creator>
		<pubDate>Sat, 28 Jan 2012 00:49:42 +0000</pubDate>
		<guid isPermaLink="false">http://bavotasan.com/?p=3707#comment-32298</guid>
		<description>Hi,

I found a couple of small bugs when trying to add your plugin to a form with multiple textareas that need to be validated.

Firstly, a simple one - the line:

&lt;pre lang=&quot;php&quot;&gt;if(wordcount &gt; options.limit) {&lt;/pre&gt;

Should actually read

&lt;pre lang=&quot;php&quot;&gt;if(wordcount &gt;= options.limit) {&lt;/pre&gt;

This is because the first version will never be true because you are not allowed to be higher than the limit, and therefore your &quot;0 words left&quot; red text will never show.


The second issue is that your #counter-text span is set using an ID name.  This is wrong as you are not able to have multiple textareas to check as when you edit any textarea past the first one, the count of words in the current textarea field will cause the count on the first textarea to update.  Therefore you should change &quot;counter-text&quot; to be a class name, then use the &#039;obj&#039; object to locate its nearest counter-text span to update.  Therefore the whole plugin should now read:


&lt;pre lang=&quot;php&quot;&gt;
(function($){
	$.fn.textareaCounter = function(options) {
		// setting the defaults
		// $(&quot;textarea&quot;).textareaCounter({ limit: 100 });
		var defaults = {
			limit: 100
		};	
		var options = $.extend(defaults, options);
 
		// and the plugin begins
		return this.each(function() {
			var obj, text, wordcount, limited;
 
			obj = $(this);

			obj.after(&#039;Max. &#039;+options.limit+&#039; words&#039;);
 
			obj.keyup(function() {
			    text = obj.val();
			    if(text === &quot;&quot;) {
			    	wordcount = 0;
			    } else {
				    wordcount = $.trim(text).split(&quot; &quot;).length;
				}
			    if(wordcount &gt;= options.limit) {
			        obj.parent().find(&quot;.counter-text&quot;).html(&#039;0 words left&#039;);
					limited = $.trim(text).split(&quot; &quot;, options.limit);
					limited = limited.join(&quot; &quot;);
					$(this).val(limited);
			    } else {
			        obj.parent().find(&quot;.counter-text&quot;).html((options.limit - wordcount)+&#039; words left&#039;);
			    } 
			});
		});
	};
})(jQuery);
&lt;/pre&gt;


I hope that helps some people who are trying to add multiple text areas.  Thanks for a great plugin though - other than those two bugs, it worked a treat!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I found a couple of small bugs when trying to add your plugin to a form with multiple textareas that need to be validated.</p>
<p>Firstly, a simple one &#8211; the line:</p>

<div class="wp_syntax"><table border='0' cellpadding='0' cellspacing='0'><tr><td><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>wordcount <span style="color: #339933;">&gt;</span> options<span style="color: #339933;">.</span>limit<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></td></tr></table></div>

<p>Should actually read</p>

<div class="wp_syntax"><table border='0' cellpadding='0' cellspacing='0'><tr><td><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>wordcount <span style="color: #339933;">&gt;=</span> options<span style="color: #339933;">.</span>limit<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></td></tr></table></div>

<p>This is because the first version will never be true because you are not allowed to be higher than the limit, and therefore your &#8220;0 words left&#8221; red text will never show.</p>
<p>The second issue is that your #counter-text span is set using an ID name.  This is wrong as you are not able to have multiple textareas to check as when you edit any textarea past the first one, the count of words in the current textarea field will cause the count on the first textarea to update.  Therefore you should change &#8220;counter-text&#8221; to be a class name, then use the &#8216;obj&#8217; object to locate its nearest counter-text span to update.  Therefore the whole plugin should now read:</p>

<div class="wp_syntax"><table border='0' cellpadding='0' cellspacing='0'><tr><td><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #000000; 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: #339933;">.</span>fn<span style="color: #339933;">.</span>textareaCounter <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// setting the defaults</span>
		<span style="color: #666666; font-style: italic;">// $(&quot;textarea&quot;).textareaCounter({ limit: 100 });</span>
		<span style="color: #000000; font-weight: bold;">var</span> defaults <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
			limit<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>	
		<span style="color: #000000; font-weight: bold;">var</span> options <span style="color: #339933;">=</span> $<span style="color: #339933;">.</span>extend<span style="color: #009900;">&#40;</span>defaults<span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// and the plugin begins</span>
		<span style="color: #b1b100;">return</span> this<span style="color: #339933;">.</span><span style="color: #990000;">each</span><span style="color: #009900;">&#40;</span><span style="color: #000000; 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: #000000; font-weight: bold;">var</span> obj<span style="color: #339933;">,</span> text<span style="color: #339933;">,</span> wordcount<span style="color: #339933;">,</span> limited<span style="color: #339933;">;</span>
&nbsp;
			obj <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>this<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			obj<span style="color: #339933;">.</span>after<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Max. '</span><span style="color: #339933;">+</span>options<span style="color: #339933;">.</span>limit<span style="color: #339933;">+</span><span style="color: #0000ff;">' words'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			obj<span style="color: #339933;">.</span>keyup<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			    text <span style="color: #339933;">=</span> obj<span style="color: #339933;">.</span>val<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>text <span style="color: #339933;">===</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			    	wordcount <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
			    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				    wordcount <span style="color: #339933;">=</span> $<span style="color: #339933;">.</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>length<span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>wordcount <span style="color: #339933;">&gt;=</span> options<span style="color: #339933;">.</span>limit<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			        obj<span style="color: #339933;">.</span>parent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>find<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.counter-text&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>html<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'0 words left'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					limited <span style="color: #339933;">=</span> $<span style="color: #339933;">.</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> options<span style="color: #339933;">.</span>limit<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					limited <span style="color: #339933;">=</span> limited<span style="color: #339933;">.</span><span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					$<span style="color: #009900;">&#40;</span>this<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>val<span style="color: #009900;">&#40;</span>limited<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>
			        obj<span style="color: #339933;">.</span>parent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>find<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.counter-text&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>html<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>options<span style="color: #339933;">.</span>limit <span style="color: #339933;">-</span> wordcount<span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">' words left'</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;">&#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: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></td></tr></table></div>

<p>I hope that helps some people who are trying to add multiple text areas.  Thanks for a great plugin though &#8211; other than those two bugs, it worked a treat!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

