<?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>Ultimate Web Tips</title>
	<atom:link href="http://www.ultimatewebtips.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ultimatewebtips.com</link>
	<description>your Wordpress, jQuery, PHP, MySQL, Linux and CSS guide to a successful website</description>
	<lastBuildDate>Tue, 21 Feb 2012 19:03:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How to use WordPress native Thickbox support in front end</title>
		<link>http://www.ultimatewebtips.com/how-to-use-wordpress-native-thickbox-support-in-front-end/</link>
		<comments>http://www.ultimatewebtips.com/how-to-use-wordpress-native-thickbox-support-in-front-end/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 15:05:42 +0000</pubDate>
		<dc:creator>Joakim Ling</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[thickbox]]></category>
		<category><![CDATA[wp_enqueue_script]]></category>
		<category><![CDATA[wp_enqueue_style]]></category>

		<guid isPermaLink="false">http://www.ultimatewebtips.com/?p=758</guid>
		<description><![CDATA[Thickbox is as jQuery plugin that WordPress use as it&#8217;s main popup window or modal view. It&#8217;s already built-in in...]]></description>
			<content:encoded><![CDATA[<p>Thickbox is as jQuery plugin that WordPress use as it&#8217;s main popup window or modal view. It&#8217;s already built-in in WordPress so why not use that in front end. No need to download or import any extra files.<br />
<span id="more-758"></span></p>
<h3>Load Thickbox javascript library</h3>
<p>Before we can start using Thickbox we need to make sure jQuery is loaded before and then load thickbox jquery plugin and stylesheet. We don&#8217;t need to enqueue jQuery because we&#8217;ll add that as a dependency and WordPress will add that automatically for us.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thickbox'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span>  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
wp_enqueue_style<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thickbox.css'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span>WPINC<span style="color: #339933;">.</span><span style="color: #0000ff;">'/js/thickbox/thickbox.css'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1.0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Hook that with a function to the <a href="http://www.ultimatewebtips.com/action-filter-and-hooks-in-wordpress/" title="Action, filter and hooks in WordPress">init hook</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'myplugin_thickbox'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> myplugin_thickbox<span style="color: #009900;">&#40;</span><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> is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thickbox'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span>  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		wp_enqueue_style<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thickbox.css'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span>WPINC<span style="color: #339933;">.</span><span style="color: #0000ff;">'/js/thickbox/thickbox.css'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1.0'</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></div></div>

<h3>Markup</h3>
<p>To add Thickbox, we only need to add <i>class=&#8221;thickbox&#8221;</i> and it will automatically add the onclick trigger.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p&gt;To open image: &lt;a href=&quot;/wp-content/uploads/2011/10/google_uwt.png&quot; class=&quot;thickbox&quot; title=&quot;Title&quot;&gt;Google search&lt;/a&gt;&lt;/p&gt;</pre></div></div>

<h3>Try it</h3>
<p>To open image: <a href="/wp-content/uploads/2011/10/google_uwt.png" class="thickbox" title="How to use WordPress native Thickbox support in front end">Google search</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ultimatewebtips.com/how-to-use-wordpress-native-thickbox-support-in-front-end/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make custom columns sortable in WordPress admin</title>
		<link>http://www.ultimatewebtips.com/make-custom-columns-sortable-in-wordpress-admin/</link>
		<comments>http://www.ultimatewebtips.com/make-custom-columns-sortable-in-wordpress-admin/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 09:26:59 +0000</pubDate>
		<dc:creator>Joakim Ling</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[manage_edit-post_columns]]></category>
		<category><![CDATA[manage_edit-post_sortable_columns]]></category>
		<category><![CDATA[manage_posts_custom_column]]></category>
		<category><![CDATA[posts_orderby]]></category>

		<guid isPermaLink="false">http://www.ultimatewebtips.com/?p=756</guid>
		<description><![CDATA[WordPress has had the ability since a long time ago to add custom fields to posts. Also called as meta-data....]]></description>
			<content:encoded><![CDATA[<p>WordPress has had the ability since a long time ago to add custom fields to posts. Also called as <b>meta-data</b>. It&#8217;s also possible to add these values to your table list and make them sortable.<br />
<span id="more-756"></span></p>
<h3>Add your hooks</h3>
<p>We will need to add 4 hooks</p>
<ul>
<li><b>manage_edit-post_columns</b>: In this hook we will add a column to the list. &#8220;post&#8221; is the post type in this case, if you have a custom post type change &#8220;post&#8221; to your post type name <i>manage_edit-customPostType_columns</i>. </li>
<li><b>manage_posts_custom_column</b>: This hook will add the value to the list</li>
<li><b>posts_orderby</b>: Will tell which columns that are sortable, will nicely use WordPress built in AJAX functions to sort the table for you.</li>
<li><b>manage_edit-post_sortable_columns</b>: Where you add the logic when sorting you custom column</li>
</ul>
<h3>Put it together</h3>
<p>Lets say we have a custom field (meta-data) &#8220;score&#8221;, and want to be able to see that in the table view and make it sortable so we can see highest scores.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'manage_edit-post_columns'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_edit_columns'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'manage_posts_custom_column'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_custom_columns'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'posts_orderby'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_orderby'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'manage_edit-post_sortable_columns'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_sort_columns'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> my_edit_columns<span style="color: #009900;">&#40;</span><span style="color: #000088;">$columns</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$columns</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'score'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Score'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$columns</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> my_custom_columns<span style="color: #009900;">&#40;</span><span style="color: #000088;">$column</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$column</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'score'</span><span style="color: #339933;">:</span>
			<span style="color: #b1b100;">echo</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'score'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</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: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> my_sort_columns<span style="color: #009900;">&#40;</span><span style="color: #000088;">$columns</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$columns</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'score'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'score'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$columns</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> my_orderby<span style="color: #009900;">&#40;</span><span style="color: #000088;">$orderby</span><span style="color: #339933;">,</span> <span style="color: #000088;">$wp_query</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span> <span style="color: #339933;">=</span> wp_parse_args<span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$order</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_key_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'orderby'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'orderby'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$order</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'score'</span><span style="color: #339933;">:</span>
			<span style="color: #000088;">$orderby</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;(SELECT `meta_value` FROM `<span style="color: #006699; font-weight: bold;">{$wpdb-&gt;postmeta}</span>` WHERE `post_id` = `<span style="color: #006699; font-weight: bold;">{$wpdb-&gt;posts}</span>`.`ID` AND `meta_key` = 'score')&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'order'</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;">$orderby</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You can either make a plugin out of it or copy it straight to your functions.php in your theme.</p>
<h3>Themedy Thesis &amp; Genesis Skin Club</h3>
<p>Themedy is a premium skin marketplace offering quality child themes for the some of the most popular Wordpress frameworks like Thesis &amp; Genesis. <a class="ga" href="/themedy-thesis-and-genesis-skin-club/" title="Themedy Thesis &amp; Genesis Skin Club">Read more</a></p><div class="shortbus"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ultimatewebtips.com/make-custom-columns-sortable-in-wordpress-admin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connect with a public key to SSH with PHP</title>
		<link>http://www.ultimatewebtips.com/connect-with-a-public-key-to-ssh-with-php/</link>
		<comments>http://www.ultimatewebtips.com/connect-with-a-public-key-to-ssh-with-php/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 01:00:02 +0000</pubDate>
		<dc:creator>Joakim Ling</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[private key]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh2_auth_pubkey_file]]></category>
		<category><![CDATA[ssh2_connect]]></category>

		<guid isPermaLink="false">http://www.ultimatewebtips.com/?p=760</guid>
		<description><![CDATA[Not a lot of people knows that PHP supports SSH. I use it to execute remote commands, auto configure of...]]></description>
			<content:encoded><![CDATA[<p>Not a lot of people knows that PHP supports SSH. I use it to execute remote commands, auto configure of web server configurations etc.</p>
<p>If you need to SSH to a server that only accepts a public key, the connection procedures get a bit more complicated.<br />
<span id="more-760"></span></p>
<h3>Authenticate using a public key read from a file</h3>
<p>This is an example how to use the exchange algorithm:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$methods</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'kex'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'diffie-hellman-group1-sha1'</span><span style="color: #339933;">,</span>
    	<span style="color: #0000ff;">'hostkey'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'ssh-dss'</span><span style="color: #339933;">,</span>
    	<span style="color: #0000ff;">'client_to_server'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'crypt'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'3des-cbc'</span><span style="color: #339933;">,</span>
	    	<span style="color: #0000ff;">'mac'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'hmac-md5'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'comp'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'none'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    	<span style="color: #0000ff;">'server_to_client'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    		<span style="color: #0000ff;">'crypt'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'3des-cbc'</span><span style="color: #339933;">,</span>
    		<span style="color: #0000ff;">'mac'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'hmac-md5'</span><span style="color: #339933;">,</span>
    		<span style="color: #0000ff;">'comp'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'none'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Full code snippet</h3>
<p>Example below will try and connect to ssh.domain.com.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'ssh.domain.com'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$public_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'./id_dsa.pub'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$private_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'./id_dsa'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'root'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$methods</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'kex'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'diffie-hellman-group1-sha1'</span><span style="color: #339933;">,</span>
    	<span style="color: #0000ff;">'hostkey'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'ssh-dss'</span><span style="color: #339933;">,</span>
    	<span style="color: #0000ff;">'client_to_server'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'crypt'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'3des-cbc'</span><span style="color: #339933;">,</span>
	    	<span style="color: #0000ff;">'mac'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'hmac-md5'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'comp'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'none'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    	<span style="color: #0000ff;">'server_to_client'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    		<span style="color: #0000ff;">'crypt'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'3des-cbc'</span><span style="color: #339933;">,</span>
    		<span style="color: #0000ff;">'mac'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'hmac-md5'</span><span style="color: #339933;">,</span>
    		<span style="color: #0000ff;">'comp'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'none'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
try <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ssh_conn</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ssh2_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$host</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">22</span><span style="color: #339933;">,</span> <span style="color: #000088;">$methods</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    		<span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Unable to establish connection'</span><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: #339933;">!</span><span style="color: #990000;">ssh2_auth_pubkey_file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ssh_conn</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'root'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$public_key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$private_key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Public Key Authentication Failed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> catch <span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$error</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$e</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Remember that you need to create your keys and upload to the server you want to connect to.</p>
<h3>Interactive PHP</h3>
<p>Learn interactive PHP <a class="ga" href="/learn-interactive-php/" title="Ajax Form Pro">click here to find out more</a></p><div class="shortbus"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ultimatewebtips.com/connect-with-a-public-key-to-ssh-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Style HTML5 placeholder color with CSS</title>
		<link>http://www.ultimatewebtips.com/style-html5-placeholder-color-with-css/</link>
		<comments>http://www.ultimatewebtips.com/style-html5-placeholder-color-with-css/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 10:08:25 +0000</pubDate>
		<dc:creator>Joakim Ling</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[placeholder]]></category>

		<guid isPermaLink="false">http://www.ultimatewebtips.com/?p=753</guid>
		<description><![CDATA[For now this is only possible in Webkit and Mozilla browsers, the discussion about best implementation is still an ongoing...]]></description>
			<content:encoded><![CDATA[<p>For now this is only possible in Webkit and Mozilla browsers, the discussion about best implementation is still an ongoing project.</p>
<p>You&#8217;ll have to use 2 rules, as the standards for this is not been set yet.<br />
<span id="more-753"></span><br />
For Mozilla:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #3333ff;">:-moz-placeholder </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>And for Webkit:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-input-placeholder </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>This goes for both input and textareas.</p>
<h3>Chrome 9 &amp; 10</h3>
<p>Do not support background-color, border, text-decoration and text-transform when styling the placeholder.</p>
<h3>Summary of CSS properties supported</h3>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th>&nbsp;</th>
<th>Chr 9-11<br />
<em>(Win 7)</em></th>
<th>Chr 15<br />
<em>(Win 7)</em></th>
<th>FF 4-8<br />
<em>(Win 7)</em></th>
<th>Saf 3.1<br />
<em>(Win XP &amp; OS X)</em></th>
<th>Saf 5<br />
<em>(Win 7 &amp; OS X)</em></th>
<th>Saf 5.1<br />
<em>(Win 7)</em></th>
<th>Opera 11<br />
<em>(Win 7)</em></th>
</tr>
<tr>
<td>background-color</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>border</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>color</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>font-size</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>font-style</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>font-weight</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>letter-spacing</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>line-height</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>padding top/bottom</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>padding left/right</td>
<td>No</td>
<td>No</td>
<td>Yes</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>text-align</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>text-decoration</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>text-transform</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
<td>No</td>
<td>No</td>
</tr>
</tbody>
</table>
<p>If you find a hack or a workaround for other browsers please let me know.</p>
<h3>Easy Starter CSS Templates</h3>
<p>Web design has never been easier with these static, Html/css templates. Choose between two or three column and select from over 50 high-res headers and 70 custom backgrounds. <a class="ga" href="/easy-starter-css-templates/" title="Easy Starter Css Templates">Read more</a></p><div class="shortbus"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ultimatewebtips.com/style-html5-placeholder-color-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t forget IPv6 if you are targeting Asia</title>
		<link>http://www.ultimatewebtips.com/dont-forget-ipv6-if-you-are-targeting-asia/</link>
		<comments>http://www.ultimatewebtips.com/dont-forget-ipv6-if-you-are-targeting-asia/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 10:58:31 +0000</pubDate>
		<dc:creator>Joakim Ling</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[Global launch]]></category>
		<category><![CDATA[IPv4]]></category>
		<category><![CDATA[IPv6]]></category>

		<guid isPermaLink="false">http://www.ultimatewebtips.com/?p=836</guid>
		<description><![CDATA[For a long time we all have known that IPv4 limitations has come to an end. In the western world...]]></description>
			<content:encoded><![CDATA[<p>For a long time we all have known that IPv4 limitations has come to an end. In the western world we are still heavily depending on IPv4 in a traditional way. However when it comes to younger and bigger   Internet nations such as China and India, relaying on IPv4 is a disaster.<br />
<span id="more-836"></span></p>
<h3>Only IPv6</h3>
<p>Yes it&#8217;s true, China does not support IPv4 anymore. Well that&#8217;s not entirely true but it&#8217;s extremely limited and IPv6 is more or less the standard, same goes for India. For many in Europe and USA IPv6 is still a futuristic thing we don&#8217;t have to worry about yet. If you are thinking of having traffic from Asia, you&#8217;d better investigate if your hosting company and DNS supports IPv6. If not, change to one that does.</p>
<p>In Europe we still have IPSs that doesn&#8217;t support IPv6, so not to lose any traffic you need to be prepared for both, not just switching to IPv6. </p>
<h3>Global launch for IPv6 June 6th 2012</h3>
<p>The Internet Society has organized a World IPv6 launch. This includes hopefully all ISPs, hardware makers, hosting companies to permanently enable &#8220;Internet Protocol Version 6 (IPv6). IPv4 will not be shut down but will run its course until the addresses run out.</p>
<h3>Largest industry commitment</h3>
<p>The IPv6 deployment will be the largest industry commitment in the history of Internet. Not only the big boys have to upgrade, even you and me have to upgrade our routers, modems and maybe even your desktop network card.</p>
<h3>Keep up to date with Internet</h3>
<p>Not just for Asia but for the biggest change in Internet history.</p>
<h3>Link Building</h3>
<p>Read the guide on link building strategies, I used these methods and I am now ranking top 10 on several keywords, <a class="ga" href="/the-link-building-black-book/" title="Link Building">Read it here</a></p><div class="shortbus"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ultimatewebtips.com/dont-forget-ipv6-if-you-are-targeting-asia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use ssh-copy-id on a different port</title>
		<link>http://www.ultimatewebtips.com/use-ssh-copy-id-on-a-different-port/</link>
		<comments>http://www.ultimatewebtips.com/use-ssh-copy-id-on-a-different-port/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 01:00:26 +0000</pubDate>
		<dc:creator>Joakim Ling</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ssh-copy-id]]></category>

		<guid isPermaLink="false">http://www.ultimatewebtips.com/?p=798</guid>
		<description><![CDATA[ssh-copy-id is a script that uses ssh to log into a remote machine and install your public key. I recently...]]></description>
			<content:encoded><![CDATA[<p>ssh-copy-id is a script that uses ssh to log into a remote machine and install your public key. I recently had to do this on a server that had ssh on a different port. Normally as you do &#8220;-p 6000&#8243; but in this case a bit tricky<br />
<span id="more-798"></span><br />
ssh-copy-id has known problems with handling non-standard ports (e.g. connecting to a different port than 22). To overcome this issue see the example below:</p>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># ssh-copy-id -i ~/.ssh/id_dsa.pub &quot;user@host -p 6000&quot;</pre></div></div>

<h3>Linux training</h3>
<p>If you need to improve your skills try my linux training guide, <a class="ga" href="/train-for-linux/" title="Linux training">read more</a></p><div class="shortbus"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ultimatewebtips.com/use-ssh-copy-id-on-a-different-port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to configure Auto Scaling with Amazon Web Services EC2 and ELB</title>
		<link>http://www.ultimatewebtips.com/how-to-configure-auto-scaling-with-amazon-web-services-ec2-and-elb/</link>
		<comments>http://www.ultimatewebtips.com/how-to-configure-auto-scaling-with-amazon-web-services-ec2-and-elb/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 11:34:59 +0000</pubDate>
		<dc:creator>Joakim Ling</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[auto scaling]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[elb]]></category>

		<guid isPermaLink="false">http://www.ultimatewebtips.com/?p=816</guid>
		<description><![CDATA[Using the Amazon Web services is a modern way to have your environment in the Cloud. It supports load balancing...]]></description>
			<content:encoded><![CDATA[<p>Using the Amazon Web services is a modern way to have your environment in the Cloud. It supports load balancing between your instances and thanks to Auto Scaling you&#8217;ll never need to pay for more than you use.</p>
<p>Basically the Auto Scaling launches additional instances to meet your demand, usually with help of a CPU alarm. Later removes them when not needed any more.<br />
<span id="more-816"></span><br />
First, you need to build your environment, I would recommend having an NFS (Network File System) server, to host your web-server configuration and your web-root directory. If you need a database, have a look at Amazon RDS (Relationship Database Service), it works great as a MySQL server.</p>
<p>Then you will need to create an Image (Amazon AMIs), install your web-server and put all your scripts so it will automatically add itself to grant access to your NFS and so on.</p>
<p>That will be your Auto Scaling Image, so whenever you have a traffic spike, the Auto Scaling will launch new instances from this image.</p>
<p>You also need to create your Amazon ELB (Elastic Load Balancer), which can be easily done from the AWS web console under the EC2 tab.</p>
<p>When all this is finished, I&#8217;d recommend you install <a href="http://aws.amazon.com/developertools/2535" title="Auto Scaling Command Line Tool" target="_blank">Auto Scaling Command Line Tool</a> and <a href="http://aws.amazon.com/developertools/2534" title="Amazon CloudWatch Command Line Tool" target="_blank">Amazon CloudWatch Command Line Tool</a> on your NFS instance. </p>
<h3>Create a launch config</h3>
<p>First thing you need it to create a launch config, that will tell what kind of instance will be launched.</p>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># as-create-launch-config MyFirstConfig --image-id ami-01234567 --instance-type m1.large --key MyFirst_PairKey --group MyFirst_Group
OK-Created launch config</pre></div></div>

<ul>
<li><b>&#8211;image-id:</b> The ID of the AMIs you created, the image with the web-server</li>
<li><b>&#8211;instance-type:</b> How many virtual CPU&#8217;s and memory for the Auto Scaling images</li>
<li><b>&#8211;key:</b> Which KeyPair to be used, important if you need SSH access</li>
<li><b>&#8211;group:</b> The name of the Security Group, if you need special ports open</li>
</ul>
<h3>Create an Auto Scaling group</h3>
<p>Next step will be to create your Auto Scaling group, here is where you tell minimum and maximum of instances.</p>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># as-create-auto-scaling-group MyFirstGroup --launch-configuration MyFirstConfig --availability-zones eu-west-1a eu-west-1b --min-size 2 --max-size 20 --load-balancers MyFirstELB
OK-Created AutoScalingGroup</pre></div></div>

<ul>
<li><b>&#8211;availability-zones</b>: Tell in which zones your instances will be launched</li>
<li><b>&#8211;min-size</b>: Minimum of instances</li>
<li><b>&#8211;max-size</b>: Maximum of instances</li>
</ul>
<h3>Create first policy Scale UP</h3>
<p>We need two policies one for scaling up and one for down, in this case I will use CPU usage as alarm and when the average CPU usage is higher then 75% on all active instances it will launch two new instances.</p>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># as-put-scaling-policy MyFirstScaleUpPolicy --auto-scaling-group MyFirstGroup --adjustment=2 --type ChangeInCapacity --cooldown 300
arn:aws:autoscaling:eu-west-1:123456789:scalingPolicy:0123456-789a-bcde-f012-3456789abcdef:autoScalingGroupName/MyFirstGroup:policyName/MyFirstScaleUpPolicy</pre></div></div>

<p>Use the output string that the policy returned to add in your alarm.</p>
<ul>
<li><b>&#8211;adjustment:</b> How many instances to create when CPU usage is higher then 75%</li>
<li><b>&#8211;type</b> In this case it&#8217;s capacity but percentage can also be used &#8220;PercentChangeInCapacity&#8221;</li>
<li><b>&#8211;cooldown</b> Time (in seconds) between a successful scaling activity and succeeding scaling activity.</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># mon-put-metric-alarm MyFirstHighCPUAlarm  --comparison-operator  GreaterThanThreshold  --evaluation-periods  1 --metric-name  CPUUtilization  --namespace &quot;AWS/EC2&quot; --period 600 --statistic Average --threshold  75 --alarm-actions arn:aws:autoscaling:eu-west-1:123456789:scalingPolicy:0123456-789a-bcde-f012-3456789abcdef:autoScalingGroupName/MyFirstGroup:policyName/MyFirstScaleUpPolicy --dimensions &quot;AutoScalingGroupName=MyFirstGroup&quot;
OK-Created Alarm</pre></div></div>

<ul>
<li><b>&#8211;comparison-operator:</b> Tells which operator to use, in this case GreaterThanThreshold.</li>
<li><b>&#8211;evaluation-periods:</b> Number of consecutive periods for which the value of the metric needs to be compared to threshold.</li>
<li><b>&#8211;metric-name:</b> The name of the metric on which to alarm.</li>
<li><b>&#8211;namespace:</b> A namespace for your alarms AWS/EC2 is default.</li>
<li><b>&#8211;period:</b> Period of metric on which to alarm.</li>
<li><b>&#8211;statistic:</b> Here we use average between periods, but others like Minimum or Maximum can be used as well.</li>
<li><b>&#8211;threshold:</b> The threshold with which the metric value will be compared.</li>
<li><b>&#8211;alarm-actions:</b> What should be sent, use your output from when you put your metrics alarm in previous step.</li>
<li><b>&#8211;dimensions:</b> Adds a tag to all instances</li>
</ul>
<h3>Create second policy Scale Down</h3>
<p>The down scaling policy needs to be added too. When average CPU usages goes below 20% on all instances, remove 1 instance.</p>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># as-put-scaling-policy MyFirstScaleDownPolicy --auto-scaling-group MyFirstGroup --adjustment=-1 --type ChangeInCapacity --cooldown 300
arn:aws:autoscaling:eu-west-1:123456789:scalingPolicy:0123456-789a-bcde-f012-3456789abcdef:autoScalingGroupName/MyFirstGroup:policyName/MyFirstScaleDownPolicy</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># mon-put-metric-alarm MyFirstLowCPUAlarm --comparison-operator LessThanThreshold --evaluation-periods  1 --metric-name  CPUUtilization --namespace  &quot;AWS/EC2&quot; --period 600 --statistic Average --threshold 20 --alarm-actions arn:aws:autoscaling:eu-west-1:123456789:scalingPolicy:0123456-789a-bcde-f012-3456789abcdef:autoScalingGroupName/MyFirstGroup:policyName/MyFirstScaleDownPolicy --dimensions &quot;AutoScalingGroupName=MyFirstGroup&quot;
OK-Created Alarm</pre></div></div>

<h3>Verify your configuration</h3>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># as-describe-auto-scaling-groups MyFirstGroup --headers
AUTO-SCALING-GROUP  GROUP-NAME   LAUNCH-CONFIG  AVAILABILITY-ZONES     LOAD-BALANCERS  MIN-SIZE  MAX-SIZE  DESIRED-CAPACITY
AUTO-SCALING-GROUP  MyFirstGroup  MyFirstConfig   eu-west-1a,eu-west-1b  MyFirstELB           2         20        2
INSTANCE  INSTANCE-ID  AVAILABILITY-ZONE  STATE      STATUS   LAUNCH-CONFIG
INSTANCE  i-01234567   eu-west-1a         InService  Healthy  MyFirstConfig
INSTANCE  i-01234567   eu-west-1b         InService  Healthy  MyFirstConfig</pre></div></div>

<h3>To remove your config</h3>
<p>First you need to remove all instances from the group. Set maximum and minimum to 0. Make the auto scaling do this for you so it removes correctly from the Load Balancer.</p>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># as-update-auto-scaling-group MyFirstGroup --min-size 0 --max-size 0
OK-Updated AutoScalingGroup</pre></div></div>

<p>Verify in the AWS console that instances are termintated</p>
<p>Next step: Delete both alarms</p>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># mon-delete-alarms MyFirstHighCPUAlarm
OK-Deleted alarms
# mon-delete-alarms MyFirstLowCPUAlarm
OK-Deleted alarms</pre></div></div>

<p>Then delete Auto scaling group</p>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># as-delete-auto-scaling-group MyFirstGroup
OK-Deleted AutoScalingGroup</pre></div></div>

<p>Last step delete your config</p>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;"># as-delete-launch-config MyFirstConfig
OK-Deleted launch configuration</pre></div></div>

<h3>Setting up a web server</h3>
<p>Learn how to configure a web server from home, <a class="ga" href="/setting-up-a-webserver/" title="Setting up a web server">read more</a></p><div class="shortbus"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ultimatewebtips.com/how-to-configure-auto-scaling-with-amazon-web-services-ec2-and-elb/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WP Easy Backup &#8211; Save all your custom files and database in one click</title>
		<link>http://www.ultimatewebtips.com/wp-easy-backup/</link>
		<comments>http://www.ultimatewebtips.com/wp-easy-backup/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 14:49:29 +0000</pubDate>
		<dc:creator>Joakim Ling</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.ultimatewebtips.com/?p=800</guid>
		<description><![CDATA[&#8220;WP Easy Backup&#8221; is a WordPress plugin that will create a database dump and zip all your media, theme and...]]></description>
			<content:encoded><![CDATA[<p>&#8220;WP Easy Backup&#8221; is a WordPress plugin that will create a database dump and zip all your media, theme and plugin files.<br />
<span id="more-800"></span><br />
When moving from one to another hosting company this plugin can quickly zip everything you need in one click.</p>
<h3>How to</h3>
<p>After installation, look under the Tools tab and open &#8220;WP Backup&#8221;. Click on &#8220;Generate WP Easy Backup Zip&#8221;. Use the link to save the file.</p>
<h3>Download</h3>
<p><a href='http://www.ultimatewebtips.com/wp-content/uploads/2012/02/wp-easy-backup.zip'><img src="http://www.ultimatewebtips.com/wp-content/uploads/2011/11/winrar.png" alt="WP Easy Backup" title="WP Easy Backup" width="50" height="50" class="alignnone size-full wp-image-628" style="border: medium none; position: relative; top: 16px;"/>WP Easy Backup</a></p>
<h3>Szuper PHP Store Locator</h3>
<p>The software allows you to add a Google map to your website that can display all your stores locations and details. It allows people to input a location and the map will display all the stores within a given radius, and also directions to get there. <a class="ga" href="/szuper-php-store-locator/" title="Szuper PHP Store Locator">Read more</a></p><div class="shortbus"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ultimatewebtips.com/wp-easy-backup/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to sudo echo to a file with help of tee</title>
		<link>http://www.ultimatewebtips.com/how-to-sudo-echo-to-a-file-with-help-of-tee/</link>
		<comments>http://www.ultimatewebtips.com/how-to-sudo-echo-to-a-file-with-help-of-tee/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 16:59:51 +0000</pubDate>
		<dc:creator>Joakim Ling</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[tee]]></category>

		<guid isPermaLink="false">http://www.ultimatewebtips.com/?p=772</guid>
		<description><![CDATA[I wasted a good few hours trying to find a good solution on how to save an echoed string with...]]></description>
			<content:encoded><![CDATA[<p>I wasted a good few hours trying to find a good solution on how to save an echoed string with sudo. I tried &#8220;sudo echo ..&#8221; and lots of different combinations before I made it work.<br />
<span id="more-772"></span><br />
I used the command &#8220;tee&#8221; which basically copies the output and copies into a variable or file. Perfect!</p>

<div class="wp_syntax"><div class="code"><pre class="linux" style="font-family:monospace;">echo &quot;String to save &quot; | sudo tee filename.txt &gt; /dev/null</pre></div></div>

<h3>Linux training</h3>
<p>If you need to improve your skills try my linux training guide, <a class="ga" href="/train-for-linux/" title="Linux training">read more</a></p><div class="shortbus"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ultimatewebtips.com/how-to-sudo-echo-to-a-file-with-help-of-tee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get custom taxonomy name from post id with get_the_terms</title>
		<link>http://www.ultimatewebtips.com/get-custom-taxonomy-name-from-post-id-with-get_the_terms/</link>
		<comments>http://www.ultimatewebtips.com/get-custom-taxonomy-name-from-post-id-with-get_the_terms/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 13:52:42 +0000</pubDate>
		<dc:creator>Joakim Ling</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[custom taxonomy]]></category>
		<category><![CDATA[get_the_terms]]></category>
		<category><![CDATA[taxonomy]]></category>

		<guid isPermaLink="false">http://www.ultimatewebtips.com/?p=745</guid>
		<description><![CDATA[If you&#8217;ve registered a custom taxonomy it&#8217;s a bit different to get data from than how you&#8217;d normally do for...]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve registered a custom taxonomy it&#8217;s a bit different to get data from than how you&#8217;d normally do for categories.<br />
<span id="more-745"></span><br />
Let&#8217;s say we want to add Brands as a taxonomy to our posts</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">register_taxonomy<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'brands'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'labels'</span><span style="color: #339933;">=&gt;</span>array<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Brands'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To get the category from post id we use <em>get_the_category</em>, but that only look for the terms in category taxonomy. So we need to get the custom term list from <em>get_the_terms</em>, as we can specify which taxonomy to look for.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$brands</span> <span style="color: #339933;">=</span> get_the_terms<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$postID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'brands'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>get_the_terms</h3>
<p>Will return an array with all brands selected in this case, false or wp_error if invalid taxonomy given.</p>
<p>So in a real example you should use something similar to this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$brands</span> <span style="color: #339933;">=</span> get_the_terms<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'brands'</span> <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: #000088;">$brands</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>is_wp_error<span style="color: #009900;">&#40;</span><span style="color: #000088;">$brands</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> 
	<span style="color: #000088;">$brand_names</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$brands</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$brand</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$brand_names</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$brand</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$brands</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$brand_names</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;p class=&quot;posts brands&quot;&gt;
	Brands: &lt;span&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$brands</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;
&lt;/p&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>If you want with links look for <em>get_the_term_list</em>.</p>
<h3>Themedy Thesis &amp; Genesis Skin Club</h3>
<p>Themedy is a premium skin marketplace offering quality child themes for the some of the most popular Wordpress frameworks like Thesis &amp; Genesis. <a class="ga" href="/themedy-thesis-and-genesis-skin-club/" title="Themedy Thesis &amp; Genesis Skin Club">Read more</a></p><div class="shortbus"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ultimatewebtips.com/get-custom-taxonomy-name-from-post-id-with-get_the_terms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 2/57 queries in 0.144 seconds using disk: basic
Object Caching 1004/1142 objects using disk: basic

Served from: www.ultimatewebtips.com @ 2012-02-22 19:35:35 -->
