<?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; tricks</title>
	<atom:link href="http://jorgepedret.com/tag/tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://jorgepedret.com</link>
	<description>Freelance Web Developer + Front End Designer</description>
	<lastBuildDate>Wed, 25 Jan 2012 16:43:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Wrapping text around images in Photoshop</title>
		<link>http://jorgepedret.com/design-2/flexible-textfields-in-photoshop/</link>
		<comments>http://jorgepedret.com/design-2/flexible-textfields-in-photoshop/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 17:15:00 +0000</pubDate>
		<dc:creator>Jorge Pedret</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[text wrapping]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://jorgepedret.com/design-2/flexible-textfields-in-photoshop/</guid>
		<description><![CDATA[Learn how to make texts in Photoshop that can be shaped. Wish I knew about this trick earlier, as the author said, is not as obvious as you want it to be. Great video by Adrian Taylor from Method &#38; Craft. They always have the best tricks that you really didn&#8217;t know about. Here&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p>Learn how to make texts in Photoshop that can be shaped. Wish I knew about this trick earlier, as the author said, is not as obvious as you want it to be.</p>
<p>Great video by <a href="https://twitter.com/#!/designtaylor" title="" target="_blank">Adrian Taylor</a> from <a href="http://methodandcraft.com/videos" title="" target="">Method &amp; Craft</a>. They always have the best tricks that you really didn&#8217;t know about.</p>
<p>Here&#8217;s a quick example on how to recreate the fancy text wrapping in CSS: <a href="http://www.kevinfreitas.net/pro/articles/fancy-text-wrapping/sample01.html" title="" target="">http://www.kevinfreitas.net/pro/articles/fancy-text-wrapping/sample01.html</a>. The html is a bit nasty because of all the extra markup it generates, but it gives you the flexibility to modify your text without having to do anything else.</p>
]]></content:encoded>
			<wfw:commentRss>http://jorgepedret.com/design-2/flexible-textfields-in-photoshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>11</slash:comments>
		</item>
		<item>
		<title>Get pages by template name in WordPress</title>
		<link>http://jorgepedret.com/web-development/get-pages-by-template-name-in-wordpress/</link>
		<comments>http://jorgepedret.com/web-development/get-pages-by-template-name-in-wordpress/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 21:01:37 +0000</pubDate>
		<dc:creator>Jorge Pedret</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[pages]]></category>
		<category><![CDATA[template name]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://jorgepedret.com/?p=535</guid>
		<description><![CDATA[Quick post to show how to retrieve pages by certain custom template. Example of use List all the published pages that use the template &#8220;page-quote.php&#8221;: How does it work? The template assigned to the page is stored as a meta data by the key &#8216;_wp_page_template&#8217;. Using the get_pages() WordPress function, we can ask for the [...]]]></description>
			<content:encoded><![CDATA[<p>Quick post to show how to retrieve pages by certain custom template. </p>
<pre class="brush: php; title: ; notranslate">
$pages = get_pages(array(
	'meta_key' =&gt; '_wp_page_template',
	'meta_value' =&gt; '&lt;Insert your template file name here&gt;'
));
</pre>
<h2>Example of use</h2>
<p>List all the published pages that use the template &#8220;page-quote.php&#8221;:</p>
<pre class="brush: php; title: ; notranslate">
$pages = get_pages(array(
	'meta_key' =&gt; '_wp_page_template',
	'meta_value' =&gt; 'page-quote.php'
));
foreach($pages as $page){
	echo $page-&gt;post_title.'&lt;br /&gt;';
}
</pre>
<h2>How does it work?</h2>
<p>The template assigned to the page is stored as a meta data by the key &#8216;_wp_page_template&#8217;. Using the get_pages() WordPress function, we can ask for the page where &#8216;_wp_page_template&#8217; equals our template name.</p>
<h2>More Info</h2>
<p><a href="http://codex.wordpress.org/Function_Reference/get_pages">get_pages() documentation</a></p>
<p>Hope this helps, post a comment if you have any questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://jorgepedret.com/web-development/get-pages-by-template-name-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Use jQuery to select child element</title>
		<link>http://jorgepedret.com/web-development/use-jquery-to-select-child-element/</link>
		<comments>http://jorgepedret.com/web-development/use-jquery-to-select-child-element/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 01:12:30 +0000</pubDate>
		<dc:creator>Jorge Pedret</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[reminder]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://jorgepedret.com/blog/?p=45</guid>
		<description><![CDATA[Suppose you have the following structure: This code will let you access the child elements of &#8216;.section&#8217; when you use an &#8216;each&#8217; function I hope this helps someone, I kept forgetting how to do this, so this is mostly a reminder for myself. Source: http://stackoverflow.com/questions/306583/jquery-this-selector-and-children/306904#306904]]></description>
			<content:encoded><![CDATA[<p>Suppose you have the following structure:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;section&quot;&gt;
	&lt;h3 class=&quot;title&quot;&gt;Title&lt;/h3&gt;
	&lt;span class=&quot;description&quot;&gt;...&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
	&lt;h3 class=&quot;title&quot;&gt;Title&lt;/h3&gt;
	&lt;span class=&quot;description&quot;&gt;...&lt;/span&gt;
&lt;/div&gt;
</pre>
<p>This code will let you access the child elements of &#8216;.section&#8217; when you use an &#8216;each&#8217; function</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
$(function(){
	$('.section').each(function(i,element){
		$('description',this).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);
	});
});
&lt;/script&gt;
</pre>
<p>I hope this helps someone, I kept forgetting how to do this, so this is mostly a reminder for myself.<br />
Source: http://stackoverflow.com/questions/306583/jquery-this-selector-and-children/306904#306904</p>
]]></content:encoded>
			<wfw:commentRss>http://jorgepedret.com/web-development/use-jquery-to-select-child-element/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

