<?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>Jorge Pedret &#187; code</title>
	<atom:link href="http://jorgepedret.com/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://jorgepedret.com</link>
	<description>Freelance Web Developer + Front End Designer</description>
	<lastBuildDate>Wed, 16 May 2012 21:32:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Placeholder text for Gravity Form input elements</title>
		<link>http://jorgepedret.com/web-development/placeholder-text-for-gravity-form-input-elements/</link>
		<comments>http://jorgepedret.com/web-development/placeholder-text-for-gravity-form-input-elements/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 01:55:28 +0000</pubDate>
		<dc:creator>Jorge Pedret</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[gravity forms]]></category>
		<category><![CDATA[placeholder]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://jorgepedret.com/?p=537</guid>
		<description><![CDATA[Surprisingly GravityForms hasn't implemented the placeholder feature yet. I know they have plans on doing so soon, but we need a solution while we wait for that. I came up with this quick solution using only GF filters and jQuery. Check it out!]]></description>
			<content:encoded><![CDATA[<p>Surprisingly GravityForms hasn&#8217;t implemented the placeholder feature yet. I know they have plans on doing so soon, but we need a solution while we wait for that.</p>
<p>I came up with this quick solution using only GF filters and jQuery.</p>
<div class="woo-sc-box info   ">Get the final code here <a href="https://gist.github.com/65dd05e3efb0fdafa6be">https://gist.github.com/65dd05e3efb0fdafa6be</a> (It&#8217;s easier to read)</div>
<h2>What the editor will look like</h2>
<p><img class="size-full wp-image-538" title="form-editor-screenshot" src="http://jorgepedret.com/wp-content/uploads/2011/06/form-editor-screenshot.png" alt="" width="528" height="718" /></p>
<h2>What the form will look like</h2>
<p><img class="alignnone size-full wp-image-539" title="form-preview-screenshot" src="http://jorgepedret.com/wp-content/uploads/2011/06/form-preview-screenshot.png" alt="" width="613" height="350" /></p>
<h2>The code</h2>
<div class="woo-sc-box info   ">Get the final code here <a href="https://gist.github.com/65dd05e3efb0fdafa6be">https://gist.github.com/65dd05e3efb0fdafa6be</a> (It&#8217;s easier to read)</div>
<h3>Add the placeholder option to the editor</h3>
<pre class="brush: php; title: ; notranslate">
/* In the functions.php file */
/* Add a custom field to the field editor (See editor screenshot) */
add_action(&quot;gform_field_standard_settings&quot;, &quot;my_standard_settings&quot;, 10, 2);
function my_standard_settings($position, $form_id){
	// Create settings on position 25 (right after Field Label)
	if($position == 25){
		?&gt;
		&lt;li class=&quot;admin_label_setting field_setting&quot; style=&quot;display: list-item; &quot;&gt;
			&lt;label for=&quot;field_placeholder&quot;&gt;Placeholder Text
				&lt;!-- Tooltip to help users understand what this field does --&gt;
				&lt;a href=&quot;javascript:void(0);&quot; class=&quot;tooltip tooltip_form_field_placeholder&quot; tooltip=&quot;&amp;lt;h6&amp;gt;Placeholder&amp;lt;/h6&amp;gt;Enter the placeholder/default text for this field.&quot;&gt;(?)&lt;/a&gt;
			&lt;/label&gt;
			&lt;input type=&quot;text&quot; id=&quot;field_placeholder&quot; class=&quot;fieldwidth-3&quot; size=&quot;35&quot; onkeyup=&quot;SetFieldProperty('placeholder', this.value);&quot;&gt;
		&lt;/li&gt;
		&lt;?php
	}
}

/* Now we execute some javascript technicalitites for the field to load correctly */
add_action(&quot;gform_editor_js&quot;, &quot;my_gform_editor_js&quot;);
function my_gform_editor_js(){
	?&gt;
	&lt;script&gt;
		//binding to the load field settings event to initialize the checkbox
		jQuery(document).bind(&quot;gform_load_field_settings&quot;, function(event, field, form){
			jQuery(&quot;#field_placeholder&quot;).val(field[&quot;placeholder&quot;]);
		});
	&lt;/script&gt;
	&lt;?php
}
</pre>
<h3>Use jQuery to inject the placeholder value to the fields</h3>
<pre class="brush: php; title: ; notranslate">
/* In the functions.php file */
/* We use jQuery to read the placeholder value and inject it to its field */
add_action('gform_enqueue_scripts',&quot;my_gform_enqueue_scripts&quot;, 10, 2);
function my_gform_enqueue_scripts($form, $is_ajax=false){
	?&gt;
	&lt;script&gt;
	jQuery(function(){
		&lt;?php
		/* Go through each one of the form fields */
		foreach($form['fields'] as $i=&gt;$field){
			/* Check if the field has an assigned placeholder */
			if(isset($field['placeholder']) &amp;&amp; !empty($field['placeholder'])){
				/* If a placeholder text exists, inject it as a new property to the field using jQuery */
				?&gt;
				jQuery('#input_&lt;?php echo $form['id']?&gt;_&lt;?php echo $field['id']?&gt;').attr('placeholder','&lt;?php echo $field['placeholder']?&gt;');
				&lt;?php
			}
		}
		?&gt;
	});
	&lt;/script&gt;
	&lt;?php
}
</pre>
<p>That&#8217;s it! take it for a spin and let me know how it goes.</p>
<div class="woo-sc-box info   ">Get the final code here <a href="https://gist.github.com/65dd05e3efb0fdafa6be">https://gist.github.com/65dd05e3efb0fdafa6be</a> (It&#8217;s easier to read)</div>
<h2>Issues</h2>
<p>Right now it only works with single lines, textareas and the other simple fields. But that&#8217;s usually the only places where you will ever need them.</p>
<h2>Internet Explorer support update</h2>
<p><a href="http://askwpgirl.com/">Angela Bowma</a> wrote a post with a <a href="http://askwpgirl.com/gravity-forms-placeholder-text-works-with-ie/">solution that works in Internet Explorer</a> or browsers that don&#8217;t support the placeholder property.</p>
]]></content:encoded>
			<wfw:commentRss>http://jorgepedret.com/web-development/placeholder-text-for-gravity-form-input-elements/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>WordPress Code Highlight</title>
		<link>http://jorgepedret.com/web-development/wordpress-code-highlight/</link>
		<comments>http://jorgepedret.com/web-development/wordpress-code-highlight/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 04:22:28 +0000</pubDate>
		<dc:creator>Jorge Pedret</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[highlight]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.jorgepedret.com/blog/?p=19</guid>
		<description><![CDATA[While I was writing the last post, I was trying to find a nice code highlighter with this requirements: Keep Indentation: I want to code to look nice, but if it&#8217;s not indented correctly as I submit it, then it&#8217;s garbage Support Different Languages: I&#8217;m going to be writing post about Javascript, PHP, XHTML and [...]]]></description>
			<content:encoded><![CDATA[<p>While I was writing the last post, I was trying to find a nice code highlighter with this requirements:</p>
<ol>
<li><strong>Keep Indentation:</strong> I want to code to look nice, but if it&#8217;s not indented correctly as I submit it, then it&#8217;s garbage</li>
<li><strong>Support Different Languages</strong>: I&#8217;m going to be writing post about Javascript, PHP, XHTML and I need all these languages/markups to be highlighted</li>
<li><strong>Line number/Plain code view:</strong> You should be able to switch between plain code view and line number. I couldn&#8217;t find specifically what I was looking for but this one had a different approach to solve this problem.</li>
<li><strong>W3C Compliant:</strong> The code produced has to be W3C Compliant.</li>
</ol>
<p>After like 1 hour of research and testing, I found <strong>SyntaxHighlighter Evolved! </strong>here is the plugin&#8217;s website: <a href="http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/" target="_blank">http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/</a>.</p>
<p>To install it you can go to your WordPress Admin panel and look for SyntaxHighlighter Evolved and install it.</p>
<p>To use it:[language]&#8230;code&#8230;[/language]<br />
Example:</p>
<pre class="brush: plain; title: ; notranslate">
1
</pre>
<p>It&#8217;s pretty straight forward, for better details on how to use it, I went to my WordPress Admin Back-end &gt; Plugins &gt; Installed, then I looked for SyntaxHighlighter Evolved and clicked on Settings, at the bottom of this page you&#8217;ll see the details of what parameters you can pass to change the functionality.</p>
<p>Do you know another code highlighter that works better than this one?</p>
]]></content:encoded>
			<wfw:commentRss>http://jorgepedret.com/web-development/wordpress-code-highlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

