<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Justin W. Hall</title>
	
	<link>http://www.justinwhall.com</link>
	<description>Wordpress Web Designer | WordPress Web Development</description>
	<lastBuildDate>Mon, 14 May 2012 17:33:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<!--built on the Whiteboard Framework-->
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/JustinWHall" /><feedburner:info uri="justinwhall" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>JustinWHall</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Add a color picker to your WordPress theme options page</title>
		<link>http://feedproxy.google.com/~r/JustinWHall/~3/EsCKJp73RD4/</link>
		<comments>http://www.justinwhall.com/add-a-color-picker-to-your-wordpress-theme-options-page/#comments</comments>
		<pubDate>Tue, 08 May 2012 23:27:55 +0000</pubDate>
		<dc:creator>Justin W. Hall</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WordPress as CMS]]></category>
		<category><![CDATA[colorpicker]]></category>
		<category><![CDATA[jscolor]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[theme options]]></category>

		<guid isPermaLink="false">http://www.justinwhall.com/?p=1180</guid>
		<description><![CDATA[This is by request and quite frankly quite simple. In following build on  &#8221;Multiple upload inputs in a WordPress theme options page?&#8221; If you theme options page is constructed in a different manner, it&#8217;s still possible this will still be of help. First, get the script I like jscolor. It&#8217;s simple, lightweight and real easy to use.<a href="http://www.justinwhall.com/add-a-color-picker-to-your-wordpress-theme-options-page/" class="read-more">&#160; Continue Reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>This is by request and quite frankly quite simple. In following build on  &#8221;<a title="Multiple upload inputs in a WordPress theme options page?" href="http://www.justinwhall.com/multiple-upload-inputs-in-a-wordpress-theme-options-page/">Multiple upload inputs in a WordPress theme options page?</a>&#8221; If you theme options page is constructed in a different manner, it&#8217;s still possible this will still be of help.</p>
<h2>First, get the script</h2>
<p>I like <a href="http://jscolor.com/">jscolor</a>. It&#8217;s simple, lightweight and real easy to use. Go there, download it and put it in your script folder.</p>
<h2>Enqueue the script</h2>
<pre class="brush: plain; title: ; notranslate">

wp_enqueue_script('jscolor.js', get_bloginfo( 'stylesheet_directory' ) . '/js/jscolor.js'); //color picker for '#' value fields
</pre>
<h2>Call the script</h2>
<p>If you read the JSColor documentations, you&#8217;ll notice that the script will be called on any text input with the CSS class &#8220;color&#8221;. Well that&#8217;s convenient!</p>
<pre class="brush: plain; title: ; notranslate">

$this-&gt;settings['h1_color'] = array(
 'section' =&gt; 'styles',
 'title' =&gt; __( 'H1' ),
 'desc' =&gt; __( 'Select a H1 color' ),
 'class' =&gt; 'color', // Custom class for CSS
 'type' =&gt; 'text',
 'std' =&gt; '333',
 );
</pre>
<p>Nothing new there with the exception of adding a &#8216;color&#8217; class. And that&#8217;s it.</p>
<img src="http://feeds.feedburner.com/~r/JustinWHall/~4/EsCKJp73RD4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.justinwhall.com/add-a-color-picker-to-your-wordpress-theme-options-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.justinwhall.com/add-a-color-picker-to-your-wordpress-theme-options-page/</feedburner:origLink></item>
		<item>
		<title>Multiple custom buddypress avatars</title>
		<link>http://feedproxy.google.com/~r/JustinWHall/~3/yr137C26RkM/</link>
		<comments>http://www.justinwhall.com/multiple-custom-buddypress-avatars/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 19:19:40 +0000</pubDate>
		<dc:creator>Justin W. Hall</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[avatar]]></category>
		<category><![CDATA[buddy]]></category>
		<category><![CDATA[buddypress]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.justinwhall.com/?p=1100</guid>
		<description><![CDATA[I while back I wrote blog on custom buddypress avatars. A commenter asked about using more then one avtar. Hmmmm, good idea! Simple solution? Sure! We got that. Create your avatars And name them something like: my-avatar-1.png my-avatar-2.png my-avatar-3.png And so on for as many as you&#8217;d like. Mix it up How does it work? We hook<a href="http://www.justinwhall.com/multiple-custom-buddypress-avatars/" class="read-more">&#160; Continue Reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>I while back I wrote blog on <a title="Custom buddypress avatars" href="http://www.justinwhall.com/custom-buddypress-avatars/">custom buddypress avatars</a>. A commenter asked about using more then one avtar. Hmmmm, good idea! Simple solution? Sure! We got that.</p>
<h2>Create your avatars</h2>
<p>And name them something like:</p>
<ol>
<li>my-avatar-1.png</li>
<li>my-avatar-2.png</li>
<li>my-avatar-3.png</li>
</ol>
<p>And so on for as many as you&#8217;d like.</p>
<h2>Mix it up</h2>
<pre class="brush: php; title: ; notranslate">
function myavatar_add_default_avatar( $url ){
    $randomNumber = rand(1, 3);
    $imgPath =  '/_inc/images/default-grav-' .  $randomNumber . '.png';
return $imgPath;
}
add_filter( 'bp_core_mysteryman_src', 'myavatar_add_default_avatar' );
</pre>
<h2>How does it work?</h2>
<p></p>
<ol>
<li>We hook into the bp_core_mysteryman_scr function.</li>
<li>Generate a random number with the <a href="http://php.net/manual/en/function.rand.php" target="_blank">rand(min, max) PHP function</a>. The key here is to define the two arguments to match the number of different default avatars you have.</li>
<li> Set the variable $imgPath to our new image path witch includes our $randomNumber variable.</li>
</ol>
<h2>Cavets?</h2>
<p>Not really. However, there is nothing being saved to the database here so with each refresh, new random avatars will be generated for users who are don&#8217;t have a defined avatar.</p>
<img src="http://feeds.feedburner.com/~r/JustinWHall/~4/yr137C26RkM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.justinwhall.com/multiple-custom-buddypress-avatars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.justinwhall.com/multiple-custom-buddypress-avatars/</feedburner:origLink></item>
		<item>
		<title>Bad value category tag for attribute rel on element a</title>
		<link>http://feedproxy.google.com/~r/JustinWHall/~3/8e4J3mHIIvA/</link>
		<comments>http://www.justinwhall.com/bad-value-category-tag-for-attribute-rel-on-element-a/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 04:24:37 +0000</pubDate>
		<dc:creator>Justin W. Hall</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web standards]]></category>

		<guid isPermaLink="false">http://www.justinwhall.com/?p=1049</guid>
		<description><![CDATA[Until HTML5 is finilized, the validator is really &#8220;experimental&#8221;. So in the mean time, we&#8217;ll all have to live with things like this. If you must have the little green check there is a clever way to get around this. Just a friendly reminder that you can pass the str_replace function an array as the<a href="http://www.justinwhall.com/bad-value-category-tag-for-attribute-rel-on-element-a/" class="read-more">&#160; Continue Reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Until HTML5 is finilized, the validator is really &#8220;experimental&#8221;. So in the mean time, we&#8217;ll all have to live with things like this. If you must have the little green check there is a clever way to get around this. Just a friendly reminder that you can pass the str_replace function an array as the string to search for.</p>
<pre class="brush: php; title: ; notranslate">
add_filter( 'the_category', 'add_nofollow_cat' );

function add_nofollow_cat( $text) {
	$strings = array('rel=&quot;category&quot;', 'rel=&quot;category tag&quot;, 'rel=&quot;whatever may need&quot;');
	$text = str_replace('rel=&quot;category tag&quot;', &quot;&quot;, $text);
	return $text;
}
</pre>
<img src="http://feeds.feedburner.com/~r/JustinWHall/~4/8e4J3mHIIvA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.justinwhall.com/bad-value-category-tag-for-attribute-rel-on-element-a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.justinwhall.com/bad-value-category-tag-for-attribute-rel-on-element-a/</feedburner:origLink></item>
		<item>
		<title>Multiple upload inputs in a WordPress theme options page?</title>
		<link>http://feedproxy.google.com/~r/JustinWHall/~3/5QO0R_yzWn0/</link>
		<comments>http://www.justinwhall.com/multiple-upload-inputs-in-a-wordpress-theme-options-page/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 02:03:48 +0000</pubDate>
		<dc:creator>Justin W. Hall</dc:creator>
				<category><![CDATA[WordPress as CMS]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[media uploader]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[settings API]]></category>
		<category><![CDATA[theme options]]></category>
		<category><![CDATA[thickbox]]></category>

		<guid isPermaLink="false">http://www.justinwhall.com/?p=1005</guid>
		<description><![CDATA[WordPress settings API Lots of info and tutorials on the net on the subject of WordPress &#8220;theme options&#8221; or  &#8221;admin&#8221; pages. Many of them are out dated and don&#8217;t subscribe to the current best practices as outlined by WordPress &#8211; in other words the settings API. Nettuts is always a great place to start. In<a href="http://www.justinwhall.com/multiple-upload-inputs-in-a-wordpress-theme-options-page/" class="read-more">&#160; Continue Reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<h2>WordPress settings API</h2>
<p>Lots of info and tutorials on the net on the subject of WordPress &#8220;theme options&#8221; or  &#8221;admin&#8221; pages. Many of them are out dated and don&#8217;t subscribe to the current best practices as outlined by WordPress &#8211; in other words the <a title="Wordpress Settings API" href="http://codex.wordpress.org/Settings_API" target="_blank">settings API</a>. <a title="Nettuts Settings API theme options" href="http://net.tutsplus.com/tutorials/wordpress/how-to-create-a-better-wordpress-options-panel/" target="_blank">Nettuts</a> is always a great place to start. In my case, the tutorial the resinated the most with me was a fairly recent post by <a title="Also The Geek Settings API WordPress Theme Options Page" href="http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/" target="_blank">Aliso The Geek</a>. Her tutorial is clear, easy to follow, results in a organized tabbed theme options page and best of all, your new WordPress theme options page will be 100% contained within a tidy class file &#8211; easily transferred from theme to theme is so desired.</p>
<h2>So what&#8217;s left to expound upon?</h2>
<p>Not much, unless you&#8217;d like to include and upload field. The easiest way to implement this, with some possible pitfalls (more on this later), is to use WordPress&#8217; built in Media Uploader and Thinkbox script.</p>
<h2>Step one: Back to your theme options class</h2>
<p>Since we are adding a new &#8220;type&#8221; we&#8217;re going to need to add a new case to the switch statement.</p>
<pre class="brush: php; title: ; notranslate">
case 'upload':
default:
   echo '&lt;input id=&quot;' . $id . '&quot; class=&quot;upload-url' . $field_class . '&quot; type=&quot;text&quot; name=&quot;mytheme_options[' . $id . ']&quot; value=&quot;' . esc_attr( $options[$id] ) . '&quot; /&gt;'
   '&lt;input id=&quot;st_upload_button&quot; class=&quot;st_upload_button&quot; type=&quot;button&quot; name=&quot;upload_button&quot; value=&quot;Upload&quot; /&gt;';

if ( $desc != '' )
   echo '
   &lt;span class=&quot;description&quot;&gt;' . $desc . '&lt;/span&gt;';

break;
</pre>
<p>Essentially the same as the &#8216;text&#8217; case. Change type to &#8220;file&#8221;, add an input button with a class of &#8220;st_upload_button&#8221; (or whatever you so desire) that will later trigger the media uploader.</p>
<h2>Step Two: Add the upload field Array</h2>
<pre class="brush: php; title: ; notranslate">
		$this-&gt;settings['st_upload'] = array(
			'title'   =&gt; __( 'Example upload Input' ),
			'desc'    =&gt; __( 'This is a description for the upload input.' ),
			'std'     =&gt; 'My logo',
			'type'    =&gt; 'upload',
			'section' =&gt; 'general'
		);
</pre>
<p>Nothing new here&#8230;</p>
<ol>
<li>Name it what you want</li>
<li>Your title</li>
<li>Your description</li>
<li>Default Value (for the text field in this case)</li>
<li>Type (our new type, yay)</li>
<li>Whatever section you&#8217;d like to appear</li>
</ol>
<p>Refresh your WordPress theme options page and your upload field should be present and look something like this:</p>
<p><a href="http://www.justinwhall.com/wp-content/uploads/2012/01/uploadex.png"><img class="alignleft size-full wp-image-1015" title="uploadex" src="http://www.justinwhall.com/wp-content/uploads/2012/01/uploadex.png" alt="" width="534" height="116" /></a></p>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2>Step Three: Gather the tools</h2>
<p>First we need to load a few scripts and styles.</p>
<ol>
<li>Medial Uploader script</li>
<li>Thickbox script</li>
<li>Thickbox CSS</li>
<li>And finally, &#8220;my-upload&#8221; script</li>
</ol>
<p>We already have a scripts() and styles() function in our class, so this is really quite easy.</p>
<pre class="brush: php; title: ; notranslate">
//Media Uploader Scripts
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_register_script('my-upload', get_bloginfo( 'stylesheet_directory' ) . '/js/uploader.js', array('jquery','media-upload','thickbox'));
wp_enqueue_script('my-upload');
</pre>
<pre class="brush: php; title: ; notranslate">
//Media Uploader Style
wp_enqueue_style('thickbox');
</pre>
<h2>Step Four: Make it do something cool</h2>
<pre class="brush: jscript; title: ; notranslate">
jQuery(document).ready(function() {

	jQuery('.st_upload_button').click(function() {
		 targetfield = jQuery(this).prev('.upload-url');
		 tb_show('', 'media-upload.php?type=image&amp;amp;TB_iframe=true');
		 return false;
	});

	window.send_to_editor = function(html) {
		 imgurl = jQuery('img',html).attr('src');
		 jQuery(targetfield).val(imgurl);
		 tb_remove();
	}

});
</pre>
<p>When the upload button is clicked, we launch the WordPress media uploader and set the &#8216;targetfield&#8217; variable to the previous text input. We&#8217;ll swing back around for this later. Next we overwrite send_to_editor,  get the image URL from the SCR attribute and then finally put that value in the target field.</p>
<h2>Pitfalls?</h2>
<p>My main complaint with the media uploader in this situation is it&#8217;s not particularly intuitive for clients or people not familiar with the finner details of WordPress. One has to either upload an image or choose from the media library and then click &#8220;insert into post&#8221;. On the other hand, it is consistent with the rest of the WordPress GUI and allows you to choose from already uploaded images.</p>
<img src="http://feeds.feedburner.com/~r/JustinWHall/~4/5QO0R_yzWn0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.justinwhall.com/multiple-upload-inputs-in-a-wordpress-theme-options-page/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		<feedburner:origLink>http://www.justinwhall.com/multiple-upload-inputs-in-a-wordpress-theme-options-page/</feedburner:origLink></item>
		<item>
		<title>Best way to embed non-flash video?</title>
		<link>http://feedproxy.google.com/~r/JustinWHall/~3/V7bUT8hk568/</link>
		<comments>http://www.justinwhall.com/best-way-to-embed-non-flash-video/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 20:09:26 +0000</pubDate>
		<dc:creator>Justin W. Hall</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[mp4]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[vimeo]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://www.justinwhall.com/?p=936</guid>
		<description><![CDATA[Video is a bit of a sticky wicket when it comes to web development. There are a number fo different approaches, all of wich have drawbacks. As of  WordPress 3.3.1 there is nothing built into the core that allows easy video embedding via the post editor. The following are the most common ways to embed video. See<a href="http://www.justinwhall.com/best-way-to-embed-non-flash-video/" class="read-more">&#160; Continue Reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Video is a bit of a sticky wicket when it comes to web development. There are a number fo different approaches, all of wich have drawbacks. As of  WordPress 3.3.1 there is nothing built into the core that allows easy video embedding via the post editor. The following are the most common ways to embed video. See for yourself wich technique(s) work best for your combination of operating system, browser, browser version and connections speed. The same video will be used in all examples.</p>
<h2>Embed Tag</h2>
<pre class="brush: xml; title: ; notranslate">
&lt;embed type=&quot;video/mp4&quot; width=&quot;352&quot; height=&quot;299&quot; src=&quot;http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4&quot; /&gt;
</pre>
<p><embed type="video/mp4" width="352" height="299" src="http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4" /></p>
<h2>Object Tag</h2>
<pre class="brush: xml; title: ; notranslate">
&lt;object width=&quot;352&quot; height=&quot;299&quot; data=&quot;http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4&quot;&gt;&lt;/object&gt;
</pre>
<p><object width="352" height="299" data="http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4"></object></p>
<h2>Video Tag</h2>
<pre class="brush: xml; title: ; notranslate">
&lt;video width=&quot;352&quot; height=&quot;299&quot; controls=&quot;controls&quot;&gt;
&lt;source src=&quot;http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4&quot; type=&quot;video/mp4&quot; /&gt;
Your browser does not support video
&lt;/video&gt;
</pre>
<p><video width="352" height="299" controls="controls"><br />
 <source src="http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4" type="video/mp4" /><br />
Your browser does not support video<br />
</video></p>
<p>And finally according to imfamous and highly contraversial <a href="http://www.w3schools.com/" target="_blank">W3schools</a></p>
<h2>The &#8220;best&#8221; solution</h2>
<pre class="brush: xml; title: ; notranslate">
&lt;video width=&quot;352&quot; height=&quot;299&quot; controls=&quot;controls&quot;&gt;
&lt;source src=&quot;http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4&quot; type=&quot;video/mp4&quot; /&gt;
&lt;object data=&quot;http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4&quot; width=&quot;352&quot; height=&quot;299&quot;&gt;
&lt;embed src=&quot;http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4&quot; width=&quot;352&quot; height=&quot;299&quot;&quot;&gt;
Your browser does not support video
&lt;/embed&gt;
&lt;/object&gt;
&lt;/video&gt;
</pre>
<p><video width="352" height="299" controls="controls"><br />
<source src="http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4" type="video/mp4" /><br />
<object data="http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4" width="352" height="299"><br />
<embed src="http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4" width="352" height="299""><br />
Your browser does not support video</embed></object><br />
</video><br />
</video><br />
How many barking dogs can you see? So where does this leave us? Well, you can begin to understand why you see so many Youtube and Vimeo embeds across the web. It&#8217;s just easier to let them do the heavy lifting&#8230;</p>
<img src="http://feeds.feedburner.com/~r/JustinWHall/~4/V7bUT8hk568" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.justinwhall.com/best-way-to-embed-non-flash-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.justinwhall.com/wp-content/uploads/2012/01/test.mp4" length="276249" type="video/mp4" />
		<feedburner:origLink>http://www.justinwhall.com/best-way-to-embed-non-flash-video/</feedburner:origLink></item>
	</channel>
</rss>

