<?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>Stv.Whtly</title>
	<atom:link href="http://stv.whtly.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://stv.whtly.com</link>
	<description>Just another technical WordPress site</description>
	<lastBuildDate>Wed, 09 May 2012 22:58:19 +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>UNIX Count total number of lines in all files recursively</title>
		<link>http://stv.whtly.com/2012/05/09/unix-count-total-number-of-lines-in-all-files-recursively/</link>
		<comments>http://stv.whtly.com/2012/05/09/unix-count-total-number-of-lines-in-all-files-recursively/#comments</comments>
		<pubDate>Wed, 09 May 2012 22:57:06 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[lines]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://stv.whtly.com/?p=917</guid>
		<description><![CDATA[Recently I have been working on a fairly large product alongside one other developer and out of interest was keen to discover roughly how many lines of code we had written between us. The following snippets use the wc command &#8230; <a href="http://stv.whtly.com/2012/05/09/unix-count-total-number-of-lines-in-all-files-recursively/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I have been working on a fairly large product alongside one other developer and out of interest was keen to discover roughly how many lines of code we had written between us.</p>
<p>The following snippets use the <a href="http://linux.die.net/man/1/wc" target="_blank">wc command</a> and can be run on the command line to output the total number of new line characters present in all files within a directory recursively.</p>
<pre>wc -l `find <em>/path/to/directory/</em> -type f`</pre>
<p><span id="more-917"></span>This will output results in the following format, showing the number of lines for each file:</p>
<pre>[root@server ~]# wc -l `find <em>/path/to/directory/</em> -type f`
 103 <em>/path/to/directory/</em>a.php
 378 <em>/path/to/directory/</em>b/c.xml
 132 <em>/path/to/directory/d</em>/e.xml
 613 total</pre>
<p>Alternatively, to output just the total number of new line characters without the file by file counts to following command can prove useful:</p>
<pre>find <em>/path/to/directory/</em> -type f -exec wc -l {} \; | awk '{total += $1} END{print total}'</pre>
<p>The output for this is a single numeric value, in this case 613:</p>
<pre>[root@server ~]# find <em>/path/to/directory/</em> -type f -exec wc -l {} \; | awk '{total += $1} END{print total}'
 613</pre>
<p>As always, there are many different methods that could be used to achieve the same results mentioned here, I just found these to be quick and sufficient for providing the rough estimates we needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://stv.whtly.com/2012/05/09/unix-count-total-number-of-lines-in-all-files-recursively/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Custom Shortlink Domain Plugin</title>
		<link>http://stv.whtly.com/2012/04/07/wordpress-custom-shortlink-domain-plugin/</link>
		<comments>http://stv.whtly.com/2012/04/07/wordpress-custom-shortlink-domain-plugin/#comments</comments>
		<pubDate>Sat, 07 Apr 2012 15:40:38 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[shortlink]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://stv.whtly.com/?p=896</guid>
		<description><![CDATA[If you are like myself and have an alternative or shorter domain name that you would prefer to use for the built-in WordPress URL shortening service, then this may just be the perfect plugin for you. The Custom Shortlink Domain &#8230; <a href="http://stv.whtly.com/2012/04/07/wordpress-custom-shortlink-domain-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are like myself and have an alternative or shorter domain name that you would prefer to use for the built-in WordPress URL shortening service, then this may just be the perfect plugin for you.</p>
<p>The <a title="Custom Shortlink Domain plugin" href="http://wordpress.org/extend/plugins/shortlink-domain/admin/" target="_blank">Custom Shortlink Domain</a> plugin was committed to the WordPress Plugin Directory today <em>(2012-04-07)</em> and provides the ability to override the domain name used.<span id="more-896"></span></p>
<p><a href="http://wordpress.org/extend/plugins/shortlink-domain/"><img class="alignnone  wp-image-908" title="Download" src="http://stv.whtly.com/wp-content/uploads/2012/04/custom-shortlink-domain-plugin.png" alt="" width="772" height="335" /></a></p>
<p>Once installed, you can enter your custom domain via the <strong>Settings &gt; Permalinks</strong> page by entering a value for the &#8220;<em>Shortlink Domain</em>&#8221; field under the Optional section.</p>
<p>In order for the custom domain to work, it must be pointed at (or parked on) your site, for more information on how this can be done you should contact your hosting provider if you are unaware of the process of doing this.</p>
<p>For full instructions on how to use the plugin or for more information visit the <a href="http://wordpress.org/extend/plugins/shortlink-domain/" target="_blank">plugin page</a>, or submit a post to the <a href="http://wordpress.org/tags/shortlink-domain?forum_id=10" target="_blank">support forums</a> for help or bug submissions.</p>
]]></content:encoded>
			<wfw:commentRss>http://stv.whtly.com/2012/04/07/wordpress-custom-shortlink-domain-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse Indigo LDAP Browser plugin installation guide</title>
		<link>http://stv.whtly.com/2012/03/15/eclipse-indigo-ldap-browser-plugin-installation-guide/</link>
		<comments>http://stv.whtly.com/2012/03/15/eclipse-indigo-ldap-browser-plugin-installation-guide/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 22:11:05 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://stv.whtly.com/?p=873</guid>
		<description><![CDATA[If you have recently installed or upgraded to Eclipse Indigo 3.7.x and require use of the LDAP browser functionality to connect to and manage an LDAP server from within Eclipse, rather than downloading the entire Apache Directory Studio you can &#8230; <a href="http://stv.whtly.com/2012/03/15/eclipse-indigo-ldap-browser-plugin-installation-guide/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you have recently installed or upgraded to Eclipse Indigo 3.7.x and require use of the LDAP browser functionality to connect to and manage an LDAP server from within Eclipse, rather than downloading the entire Apache Directory Studio you can simply install the LDAP browser plugin.</p>
<p>To install this plugin you will need to launch the Eclipse Indigo application and in the main menu bar go to <strong>Help &gt; Install New Software</strong>.<span id="more-873"></span></p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-install-new-software.png"><img class="alignnone size-medium wp-image-876" title="Eclipse - Install New Software" src="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-install-new-software-300x155.png" alt="" width="300" height="155" /></a></p>
<p>In the Available Software screen, work with<strong> http://directory.apache.org/studio/update/1.x</strong> by either entering it into the input or clicking <strong>Add&#8230;</strong> then providing a name, such as <em>&#8220;Apache Directory Studio</em>&#8221; and using this URL as the location value.</p>
<p>Once loaded, you will see a list of available software, you need to select <em>&#8220;Apache Directory Studio LDAP Browser&#8221;</em> and click <strong>Next &gt;</strong>.</p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-install-ldap-browser.png"><img class="alignnone size-medium wp-image-878" title="Eclipse - Install LDAP Browser" src="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-install-ldap-browser-300x296.png" alt="" width="300" height="296" /></a></p>
<p>After the calculation of dependencies has taken place, you will need to review the items to be installed and click <strong>Next &gt;</strong> once again.</p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-install-ldap-browser-review.png"><img class="alignnone size-medium wp-image-877" title="Eclipse - Install LDAP Browser Review" src="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-install-ldap-browser-review-300x296.png" alt="" width="300" height="296" /></a></p>
<p>At this point you are required to review the licenses before the software can be installed. If you accept the terms click <strong>Finish</strong> to begin the installation process.</p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-installing-software.png"><img class="alignnone size-medium wp-image-879" title="Eclipse - Installing Software" src="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-installing-software-300x113.png" alt="" width="300" height="113" /></a></p>
<p>During the installation you may be prompted to trust the Apache Directory Studio certificate, ensure you have<strong> checked the box</strong> before clicking <strong>OK</strong> otherwise the install will be aborted.</p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-install-ldap-browser-certificate.png"><img class="alignnone size-medium wp-image-880" title="Eclipse - Apache Directory Studio Certificate" src="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-install-ldap-browser-certificate-275x300.png" alt="" width="275" height="300" /></a></p>
<p>Once the installation is complete you should<strong> restart Eclipse</strong> before you can begin using the LDAP Browser.</p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-install-new-software-restart.png"><img class="alignnone size-medium wp-image-881" title="Eclipse - Install Software Restart" src="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-install-new-software-restart-300x65.png" alt="" width="300" height="65" /></a></p>
<p>Once restarted, you may not be able to see the LDAP Browser option. To open the perspective go to <strong>Window &gt; Open Perspective &gt; Other </strong>and choose<strong> LDAP</strong> from the options list before clicking <strong>OK</strong>.</p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-open-perspective.png"><img class="alignnone size-medium wp-image-882" title="Eclipse - Open Perspective" src="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-open-perspective-300x155.png" alt="" width="300" height="155" /></a></p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-open-perspective-ldap.png"><img class="alignnone size-medium wp-image-883" title="Eclipse - Open LDAP Perspective" src="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-open-perspective-ldap-259x300.png" alt="" width="259" height="300" /></a></p>
<p>You can then proceed to adding a new Connection to your LDAP server by clicking on the small <strong>LDAP+</strong> icon in the Connections view which can usually be found in the bottom left of the screen.</p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-new-ldap-connection.png"><img class="alignnone size-medium wp-image-884" title="Eclipse - New LDAP Connection" src="http://stv.whtly.com/wp-content/uploads/2012/03/eclipse-new-ldap-connection-300x126.png" alt="" width="300" height="126" /></a></p>
<p>If this section is not visible it can be enabled by going to <strong>Window &gt; Show View &gt; Connections</strong>.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://stv.whtly.com/2012/03/15/eclipse-indigo-ldap-browser-plugin-installation-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using front-end AJAX requests in your WordPress plugins</title>
		<link>http://stv.whtly.com/2011/09/12/using-front-end-ajax-requests-in-your-wordpress-plugins/</link>
		<comments>http://stv.whtly.com/2011/09/12/using-front-end-ajax-requests-in-your-wordpress-plugins/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 16:55:37 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://flav36rs.com/?p=843</guid>
		<description><![CDATA[Although it is fairly uncommon to be adding AJAX functionality to your WordPress plugins, it can be necessary for it to be added. Luckily it is quite easy and straight forward to integrate the required components as and when they &#8230; <a href="http://stv.whtly.com/2011/09/12/using-front-end-ajax-requests-in-your-wordpress-plugins/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Although it is fairly uncommon to be adding AJAX functionality to your WordPress plugins, it can be necessary for it to be added. Luckily it is quite easy and straight forward to integrate the required components as and when they are required.</p>
<p>To help explain how this can be achieved, we will be creating a plugin called &#8220;<strong>Ajax Example</strong>&#8220;, stored in the folder &#8220;<strong>ajax-example</strong>&#8221; inside the plugin directory of your WordPress install.</p>
<p><span id="more-843"></span>Further information on <a title="Writing a Plugin" href="http://codex.wordpress.org/Writing_a_Plugin" target="_blank">creating a WordPress plugin</a> can be found on <a title="WordPress.org" href="http://wordpress.org/" target="_blank">WordPress.org</a> and other resources, so won&#8217;t go into too much detail here.</p>
<p>First we need to create a file called &#8220;<strong>index.html</strong>&#8221; and copy the following into this file:</p>
<pre>&lt;?php
/*
Plugin Name: Ajax Example
Plugin URI: http://wp.me/pWbfz-dB
Description: Simple example of how to integrate front-end ajax requests via your plugin.
Version: 0.1
Date: 2011-09-01
Author: Steve Whiteley
Author URI: http://flav36rs.com
*/

class Ajax_Example
{
	public function __construct()
	{
		// ...
 	}
}

$ajaxExample = new Ajax_Example();

?&gt;</pre>
<p>We will be using the OOP structure for this plugin instead of the prefixed function format, however could be converted with ease. This class provides the skeleton structure of our plugin, you should save this file to our &#8220;<strong>ajax-example</strong>&#8221; folder before we start to add more functionality.</p>
<p>The next step is to include the <strong>JavaScript</strong> file that performs the AJAX request, which is called by the &#8220;<a title="Init Action Hook" href="http://codex.wordpress.org/Plugin_API/Action_Reference/init" target="_blank">init</a>&#8221; action hook added to the class constructor method:</p>
<pre>add_action( 'init', array( &amp;$this, 'init' ) );</pre>
<p>Then we add the init function to the plugin, which includes calls to insert the JavaScript file <em>(wp_enqueue_script)</em> and set the parameters required by the external file <em>(wp_localize_script)</em>.</p>
<pre>public function init()
{
	wp_enqueue_script( 'ajax-example', plugin_dir_url( __FILE__ ) . 'ajax.js', array( 'jquery' ) );
	wp_localize_script( 'ajax-example', 'AjaxExample', array(
		'ajaxurl' =&gt; admin_url( 'admin-ajax.php' ),
		'nonce' =&gt; wp_create_nonce( 'ajax-example-nonce' )
	) );
}</pre>
<p>Additional parameters can be added to array if they are required, the two mentioned should be the minimum that are required.</p>
<p>While we&#8217;re here, we should add the function that handles the response generated by the AJAX request. Notice here that we check the nonce value that is defined in the function above and set the content type before returning the encoded JSON array.</p>
<pre>public function ajax_call()
{
	if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $_REQUEST['nonce'], 'ajax-example-nonce' ) )
		die ( 'Invalid Nonce' );
	header( "Content-Type: application/json" );
	echo json_encode( array(
		'success' =&gt; true,
		'time' =&gt; time()
	) );
	exit;
}</pre>
<p>Create &#8220;<strong>ajax-example/ajax.js</strong>&#8221; and copy the following snippet into this file. In order to perform the AJAX request, we use the jQuery .getJSON() method. <a title="jQuery AJAX methods" href="http://api.jquery.com/category/ajax/" target="_blank">Alternative methods</a> could be used depending on the type of request you are performing.</p>
<pre>jQuery.getJSON(
    AjaxExample.ajaxurl,
    {
        action: 'ajax-example',
        nonce: AjaxExample.nonce
    },
    function( response ) {
    	alert( response.success );
    }
);</pre>
<p>Unfortunately this won&#8217;t actually do anything until we add two hooks to extend the built in AJAX functionality. These are added to the class constructor, the first <em>(wp_ajax_nopriv_ajax-example)</em> provides access for logged in users, the second <em>(wp_ajax_ajax-example)</em> for anonymous / non-logged in visitors.</p>
<pre>if ( is_admin() ) {
	add_action( 'wp_ajax_nopriv_ajax-example', array( &amp;$this, 'ajax_call' ) );
	add_action( 'wp_ajax_ajax-example', array( &amp;$this, 'ajax_call' ) );
}</pre>
<p>Please be aware that when using these hooks, they are called from within <strong>is_admin()</strong>, otherwise they are not correctly set.</p>
<p>The full contents of the plugin file &#8220;<strong>ajax-example/index.php</strong>&#8221; should be as follows:</p>
<pre>&lt;?php
/*
Plugin Name: Ajax Example
Plugin URI: http://wp.me/pWbfz-dB
Description: Simple example of how to integrate front-end ajax requests via your plugin.
Version: 0.1
Date: 2011-09-01
Author: Steve Whiteley
Author URI: http://flav36rs.com
*/

class Ajax_Example
{
	public function __construct()
	{
		if ( is_admin() ) {
			add_action( 'wp_ajax_nopriv_ajax-example', array( &amp;$this, 'ajax_call' ) );
			add_action( 'wp_ajax_ajax-example', array( &amp;$this, 'ajax_call' ) );
		}
		add_action( 'init', array( &amp;$this, 'init' ) );
	}

	public function init()
	{
		wp_enqueue_script( 'ajax-example', plugin_dir_url( __FILE__ ) . 'ajax.js', array( 'jquery' ) );
		wp_localize_script( 'ajax-example', 'AjaxExample', array(
		    'ajaxurl' =&gt; admin_url( 'admin-ajax.php' ),
		    'nonce' =&gt; wp_create_nonce( 'ajax-example-nonce' )
		) );
	}

	public function ajax_call()
	{
		if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $_REQUEST['nonce'], 'ajax-example-nonce' ) )
			die ( 'Invalid Nonce' );
		header( "Content-Type: application/json" );
		echo json_encode( array(
			'success' =&gt; true,
			'time' =&gt; time()
		) );
		exit;
	}

}

$ajaxExample = new Ajax_Example();

?&gt;</pre>
<p>Other things to consider when using the example code provided above are that you should probably ensure jQuery is loaded and possibly only add the the scripts to the pages that they are required, rather than globally.</p>
<p>This functionality was tested with <strong>WordPress 3.2.1</strong>, it may however change and be simplified in future releases.</p>
]]></content:encoded>
			<wfw:commentRss>http://stv.whtly.com/2011/09/12/using-front-end-ajax-requests-in-your-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Forcing a WordPress plugin to be loaded before all other plugins</title>
		<link>http://stv.whtly.com/2011/09/03/forcing-a-wordpress-plugin-to-be-loaded-before-all-other-plugins/</link>
		<comments>http://stv.whtly.com/2011/09/03/forcing-a-wordpress-plugin-to-be-loaded-before-all-other-plugins/#comments</comments>
		<pubDate>Sat, 03 Sep 2011 14:05:20 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[force]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[order]]></category>

		<guid isPermaLink="false">http://flav36rs.com/?p=829</guid>
		<description><![CDATA[When you activate a plugin via the WordPress admin panel it calls the action hook &#8220;activated_plugin&#8220;, which updates the &#8220;active_plugins&#8221; site option stored in the database to determine which plugins your site should load. The option value is a serialized &#8230; <a href="http://stv.whtly.com/2011/09/03/forcing-a-wordpress-plugin-to-be-loaded-before-all-other-plugins/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When you activate a plugin via the WordPress admin panel it calls the action hook &#8220;<em>activated_plugin</em>&#8220;, which updates the &#8220;<em>active_plugins</em>&#8221; site option stored in the database to determine which plugins your site should load.</p>
<p>The option value is a serialized array of the active plugins saved in alphabetical order according to the plugin directory and file name, for example:</p>
<p><span id="more-829"></span>
<pre>Array
(
	[0] =&gt; akismet/akismet.php
	[1] =&gt; example-plugin/index.php
)</pre>
<p>You can however alter the order of the plugins in the array, which will in turn set the order in which the plugins are loaded by WordPress.</p>
<p>The first step towards adjusting the order is to add the following action to your plugin file, which is most likely to be <em>/my-plugin/index.php</em> or <em>/my-plugin/my-plugin.php</em>.</p>
<pre>add_action( 'activated_plugin', 'my_plugin_load_first' );</pre>
<p>Next you need to include the functionality to perform the actual re-ordering. The following function will fetch the existing list, check that your plugin is in the array and if so remove then append it to the beginning, before finally saving the altered list to the database.</p>
<pre>function my_plugin_load_first()
{
	$path = str_replace( WP_PLUGIN_DIR . '/', '', __FILE__ );
	if ( $plugins = get_option( 'active_plugins' ) ) {
		if ( $key = array_search( $path, $plugins ) ) {
			array_splice( $plugins, $key, 1 );
			array_unshift( $plugins, $path );
			update_option( 'active_plugins', $plugins );
		}
	}
}</pre>
<p>It should not be necessary for you to adjust anything specified here other than modifying the name of the function used to suit the namespace used by your plugin.</p>
<p>One final thing to consider is only adding this action when the dashboard or administration panels are being displayed, by making use of the <a href="http://codex.wordpress.org/Function_Reference/is_admin" target="_blank">is_admin()</a> conditional tag.</p>
<p><strong>Please note that modifying this option is not something I recommend people do unless absolutely necessary, and it my situation it proved to be very useful.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://stv.whtly.com/2011/09/03/forcing-a-wordpress-plugin-to-be-loaded-before-all-other-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding custom columns to the WordPress comments admin page</title>
		<link>http://stv.whtly.com/2011/07/27/adding-custom-columns-to-the-wordpress-comments-admin-page/</link>
		<comments>http://stv.whtly.com/2011/07/27/adding-custom-columns-to-the-wordpress-comments-admin-page/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 20:24:35 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[custom]]></category>

		<guid isPermaLink="false">http://flav36rs.com/?p=806</guid>
		<description><![CDATA[Adding custom columns to the WordPress admin pages is fairly easy, however not all the filters available to you are displayed on Plugin API Filter Reference page. The following article will take you through the process of adding additional columns &#8230; <a href="http://stv.whtly.com/2011/07/27/adding-custom-columns-to-the-wordpress-comments-admin-page/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Adding custom columns to the WordPress admin pages is fairly easy, however not all the filters available to you are displayed on <a title="WordPress.org Filter Reference" href="http://codex.wordpress.org/Plugin_API/Filter_Reference" target="_blank">Plugin API Filter Reference</a> page. The following article will take you through the process of adding additional columns to the <strong>comments admin page</strong> using two undocumented filters.</p>
<p>If you are not a plugin author intending to use this functionality within a plugin, you should place the following code examples into your theme&#8217;s <strong>functions.php</strong> file.</p>
<p><span id="more-806"></span></p>
<p>The first filter &#8220;<em>manage_edit-comments_columns</em>&#8221; is used to adjust the table headings by appending a column called &#8220;<strong>My Custom Column</strong>&#8221; to the end of the table headings.</p>
<pre>function myplugin_comment_columns( $columns )
{
	$columns['my_custom_column'] = __( 'My Custom Column' );
	return $columns;
}
add_filter( 'manage_edit-comments_columns', 'myplugin_comment_columns' );</pre>
<p>The second filter &#8220;<em>manage_comments_custom_column</em>&#8221; will populate each comment row with data. It checks that the column ID matches that set in the function above (&#8220;my_custom_column&#8221;) and outputs &#8220;<strong>Custom Data for ID:</strong>&#8221; followed by the comment ID  for each row.</p>
<pre>function myplugin_comment_column( $column, $comment_ID )
{
	if ( 'my_custom_column' == $column ) {
		echo 'Custom Data for ID: ' . $comment_ID;
	}
}
add_filter( 'manage_comments_custom_column', 'myplugin_comment_column', 10, 2 );</pre>
<p>Outputting this text isn&#8217;t really that useful to anyone, instead you will more likely want to show some actual data related to the comment. One thing you may want to do is adjust the function to display some meta data stored for the comment.</p>
<pre>function myplugin_comment_column( $column, $comment_ID )
{
	if ( 'my_custom_column' == $column ) {
		if ( $meta = get_comment_meta( $comment_ID, $column , true ) ) {
			echo $meta;
		}
	}
}</pre>
<p>The above snippet assumes that meta key is the same as the column ID (&#8220;my_custom_column&#8221;) and you only want to add a single column, but what if you want to add multiple columns and show different data?</p>
<pre>function myplugin_comment_columns( $columns )
{
	return array_merge( $columns, array(
		'custom_column_one' =&gt; __( 'Custom Column One' ),
		'custom_column_two' =&gt; __( 'Custom Column Two' ),
		'custom_column_three' =&gt; __( 'Custom Column Three' )
	) );
}
add_filter( 'manage_edit-comments_columns', 'myplugin_comment_columns' );

function myplugin_comment_column( $column, $comment_ID )
{
	switch ( $column ) {
		case 'custom_column_one':
		case 'custom_column_two':
			if ( $meta = get_comment_meta( $comment_ID, $column , true ) ) {
				echo $meta;
			} else {
				echo '-';
			}
		break;
		case 'custom_column_three':
			echo 'Third Column Data';
		break;
	}
}
add_filter( 'manage_comments_custom_column', 'myplugin_comment_column', 10, 2 );</pre>
<p>The above will add three columns to the edit page, the first two will try to lookup <strong>comment meta data</strong> and the third output the text &#8220;<strong>Third Column Data</strong>&#8221; for the sake of this example.</p>
<p>Similar function and filter combinations can be used for adding columns to the other admin pages. Just adjust the filters used by replacing <em>{type}</em> with either &#8216;<strong>posts</strong>&#8216; or &#8216;<strong>pages</strong>&#8216; in the filters below, however we will not go into further detail here.</p>
<ul>
<li>manage_<strong>{type}</strong>_columns</li>
<li>manage_<strong>{type}</strong>_custom_column</li>
</ul>
<p><strong>Please note</strong> that the above functions have only been tested using WordPress 3.2.1 and cannot guarantee they will work correctly or the same in older versions.</p>
]]></content:encoded>
			<wfw:commentRss>http://stv.whtly.com/2011/07/27/adding-custom-columns-to-the-wordpress-comments-admin-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Connecting to an Apple Time Capsule Disk over the internet (WAN) using Windows</title>
		<link>http://stv.whtly.com/2011/07/03/connecting-to-an-apple-time-capsule-disk-over-the-internet-wan-using-windows/</link>
		<comments>http://stv.whtly.com/2011/07/03/connecting-to-an-apple-time-capsule-disk-over-the-internet-wan-using-windows/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 09:41:41 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Disk]]></category>
		<category><![CDATA[Time Capsule]]></category>

		<guid isPermaLink="false">http://flav36rs.com/?p=778</guid>
		<description><![CDATA[If you are like myself and sitting on the fence between Windows and Apple based products, you may want to communicate between Windows1 and your Apple Time Capsule Disk both locally (LAN) and via the internet (WAN). Setting up the &#8230; <a href="http://stv.whtly.com/2011/07/03/connecting-to-an-apple-time-capsule-disk-over-the-internet-wan-using-windows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are like myself and sitting on the fence between Windows and Apple based products, you may want to communicate between Windows<sup>1</sup> and your Apple Time Capsule Disk both locally (LAN) and via the internet (WAN).</p>
<p>Setting up the Time Capsule Disk as just a local network drive is fairly easy<sup>2</sup>, however there is little instruction on sharing disks over WAN if you&#8217;re using Windows.</p>
<p><span id="more-778"></span></p>
<p>The following instructions assume that you have already configured your Time Capsule as a router and that you are assigned a static IP Address by your <abbr title="Internet Service Provider">ISP</abbr><sup>3</sup>.</p>
<p><strong>Open the AirPort Utility Program.</strong></p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2011/07/airport-utility1.jpg"><img class="alignnone size-medium wp-image-782" title="Apple Airport Utility" src="http://flav36rs.com/wp-content/uploads/2011/07/airport-utility-300x203.jpg" alt="" width="300" height="203" /></a></p>
<p><em>Double click on your Time Machine in the panel on the left.</em></p>
<p><strong><a href="http://stv.whtly.com/wp-content/uploads/2011/07/time-machine1.jpg"><img class="alignnone size-medium wp-image-790" title="Apple Time Machine" src="http://flav36rs.com/wp-content/uploads/2011/07/time-machine-291x300.jpg" alt="" width="291" height="300" /></a><br />
</strong></p>
<p><strong>Click the Disks icon.</strong></p>
<p><strong><a href="http://stv.whtly.com/wp-content/uploads/2011/07/disks1.jpg"><img class="alignnone size-medium wp-image-783" title="Time Machine Disks" src="http://flav36rs.com/wp-content/uploads/2011/07/disks-291x300.jpg" alt="" width="291" height="300" /></a><br />
</strong></p>
<p><em>You should make a note of the Time Capsule Disk &#8220;Name&#8221; stated here as it will be required later, for example here it is &#8220;Time Capsule&#8221;.</em></p>
<p><strong>Click the &#8220;File Sharing&#8221; Tab.</strong></p>
<p><strong><a href="http://stv.whtly.com/wp-content/uploads/2011/07/disks-file-sharing1.jpg"><img class="alignnone size-medium wp-image-784" title="Disk File Sharing" src="http://flav36rs.com/wp-content/uploads/2011/07/disks-file-sharing-291x300.jpg" alt="" width="291" height="300" /></a><br />
</strong></p>
<ol>
<li>Ensure &#8220;Enable File Sharing&#8221; is checked.</li>
<li>Secure Shared Disks should have &#8220;With a disk password&#8221; selected.</li>
<li>Enter and verify a &#8220;Disk Password&#8221;.</li>
<li>Check the &#8220;Share disks over WAN&#8221; box.</li>
<li>Lastly, click the &#8220;Update&#8221; button to restart the TC.</li>
</ol>
<p><strong>Lookup the IP Address.</strong></p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2011/07/ip-address1.jpg"><img class="alignnone size-medium wp-image-786" title="IP Address" src="http://flav36rs.com/wp-content/uploads/2011/07/ip-address-300x50.jpg" alt="" width="300" height="50" /></a></p>
<p><em>Simply visiting <a title="What Is My IP" href="http://whatismyip.com" target="_blank">whatismyip.com</a> should be enough for this unless you have a more complicated network configuration.</em></p>
<p><strong>Map the Time Capsule as a network drive.</strong></p>
<p><strong><a href="http://stv.whtly.com/wp-content/uploads/2011/07/map-network-drive-menu1.jpg"><img class="alignnone size-medium wp-image-788" title="map-network-drive-menu" src="http://flav36rs.com/wp-content/uploads/2011/07/map-network-drive-menu-300x181.jpg" alt="" width="300" height="181" /></a></strong></p>
<p><em>Click on &#8220;Computer&#8221; in the Start Menu, then &#8220;Map Network Drive&#8221; in the top menu.</em></p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2011/07/map-network-drive1.jpg"><img class="alignnone size-medium wp-image-791" title="map-network-drive" src="http://flav36rs.com/wp-content/uploads/2011/07/map-network-drive-300x219.jpg" alt="" width="300" height="219" /></a></p>
<ol>
<li> Select an available the drive to mount the Time Capsule as, e.g. &#8220;X:&#8221;.</li>
<li>Enter &#8220;\\yourip\diskname&#8221; as the &#8220;Folder&#8221; value, e.g. \\12.34.56.78\Time Capsule. <em>(These are the two values from earlier)</em></li>
<li>Click &#8220;Finish&#8221;.</li>
</ol>
<p><strong>Enter authentication details.</strong></p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2011/07/enter-network-password1.jpg"><img class="alignnone size-medium wp-image-785" title="enter-network-password" src="http://flav36rs.com/wp-content/uploads/2011/07/enter-network-password-300x188.jpg" alt="" width="300" height="188" /></a></p>
<p><em>The user should be &#8220;admin&#8221; and the password whatever you set as the disk password earlier.</em> Click OK to complete the setup process.</p>
<p><a href="http://stv.whtly.com/wp-content/uploads/2011/07/mapped-drive1.jpg"><img class="alignnone size-medium wp-image-789" title="mapped-drive" src="http://flav36rs.com/wp-content/uploads/2011/07/mapped-drive-300x181.jpg" alt="" width="300" height="181" /></a></p>
<p>You should then see the Time Capsule drive when navigating back to &#8220;Computer&#8221;<sup>4</sup>.</p>
<p><strong>Notes</strong></p>
<ol>
<li>These instructions were written using Windows 7, older versions of the OS may require variations of the setup process.</li>
<li>Follow the steps above but instead of enter entering the IP Address when mapping the drive, simply click browse and click the name of the Time Capsule Disk folder.</li>
<li>UK Virgin Media customers should be OK with this, although you are not strictly given a static IP Address, it&#8217;s uncommon for it to change.</li>
<li>If you have the TC mapped as a local drive as well as a following these instructions, you will see two Network drives for the TC.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://stv.whtly.com/2011/07/03/connecting-to-an-apple-time-capsule-disk-over-the-internet-wan-using-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress append page slug to body class</title>
		<link>http://stv.whtly.com/2011/02/19/wordpress-append-page-slug-to-body-class/</link>
		<comments>http://stv.whtly.com/2011/02/19/wordpress-append-page-slug-to-body-class/#comments</comments>
		<pubDate>Sat, 19 Feb 2011 13:53:15 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[body]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[slug]]></category>

		<guid isPermaLink="false">http://36flavours.com/?p=775</guid>
		<description><![CDATA[Styling different pages in WordPress is a relatively easy process if you make use of the default body classes that are made available to you, especially the unique page ID class &#8220;page-id-123&#8220;. The problem with using the ID class to &#8230; <a href="http://stv.whtly.com/2011/02/19/wordpress-append-page-slug-to-body-class/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Styling different pages in WordPress is a relatively easy process if you make use of the default <a href="http://codex.wordpress.org/Function_Reference/body_class" target="_blank">body classes</a> that are made available to you, especially the unique page ID class &#8220;<em>page-id-123</em>&#8220;.</p>
<p>The <strong>problem</strong> with using the ID class to identify an individual page is that a page ID can quite easily change when working with a development version or even migrating your blog from one install to another.<span id="more-775"></span></p>
<p>One <strong>solution</strong> to this problem is to append the post type and slug as a class name to the body, e.g. &#8216;<em>page-about</em>&#8216; or &#8216;<em>post-hello-world</em>&#8216;.</p>
<p>Simply add the following to your <a href="http://codex.wordpress.org/Theme_Development#Functions_File" target="_blank">functions.php</a> file to automatically append the classes:</p>
<pre lang="php" escaped="true">function add_body_class( $classes )
{
    global $post;
    if ( isset( $post ) ) {
        $classes[] = $post-&gt;post_type . '-' . $post-&gt;post_name;
    }
    return $classes;
}
add_filter( 'body_class', 'add_body_class' );</pre>
<p><strong>Note: </strong>This method will also apply to individual post pages and custom post types.</p>
]]></content:encoded>
			<wfw:commentRss>http://stv.whtly.com/2011/02/19/wordpress-append-page-slug-to-body-class/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to remove the Admin Bar in WordPress 3.1 correctly</title>
		<link>http://stv.whtly.com/2011/02/07/how-to-remove-the-admin-bar-in-wordpress-3-1-correctly/</link>
		<comments>http://stv.whtly.com/2011/02/07/how-to-remove-the-admin-bar-in-wordpress-3-1-correctly/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 19:05:00 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[bar]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[remove]]></category>

		<guid isPermaLink="false">http://36flavours.com/?p=763</guid>
		<description><![CDATA[Although the WordPress Admin Bar can be hidden by a user visiting their profile page in the Admin Panel (Users &#62; Your Profile), there may be a situation where you want to force the removal without instructing the user to &#8230; <a href="http://stv.whtly.com/2011/02/07/how-to-remove-the-admin-bar-in-wordpress-3-1-correctly/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Although the WordPress Admin Bar can be hidden by a user visiting their profile page in the Admin Panel (Users &gt; Your Profile), there may be a situation where you want to force the removal without instructing the user to amend their settings or updating their settings automatically.</p>
<p>When the issue of removing the Admin Bar first cropped up, the solution was to remove the associated init action, however this is not the correct method of disabling it and should not be used.<span id="more-763"></span></p>
<p><code><span style="text-decoration: line-through;">remove_action('init', 'wp_admin_bar_init');</span></code></p>
<p>Instead, you either use the show_admin_bar filter and simply return false:</p>
<pre lang="php" escaped="true">function hide_admin_bar() {
    return false;
}
add_filter( 'show_admin_bar', 'hide_admin_bar' );</pre>
<p>Or alternatively call the show_admin_bar function directly:</p>
<pre lang="php" escaped="true">show_admin_bar( false );</pre>
<p>If you are disabling the bar from within an init action it is important that you correctly pass the priority value, otherwise some of the assets may remain (such as the JavaScript file) and cause unwanted behaviour.</p>
<p>Using a priority of 9 seemed to be be the most successful from my experiments, although other possibilities may be used:</p>
<pre lang="php" escaped="true">add_action( 'init', 'my_init_function', 9 );</pre>
<p>There are a number of comments in the source code of 3.1, discouraging you from using the previous method of removing the wp_admin_bar_init action, so encourage anyone to update the method they are using.</p>
<p>All of the methods mentioned here can be used in either your plugin file or functions.php file.</p>
]]></content:encoded>
			<wfw:commentRss>http://stv.whtly.com/2011/02/07/how-to-remove-the-admin-bar-in-wordpress-3-1-correctly/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Fixing the incorrect auto date and time on the iPhone 4</title>
		<link>http://stv.whtly.com/2011/01/31/fixing-the-incorrect-auto-date-and-time-on-the-iphone-4/</link>
		<comments>http://stv.whtly.com/2011/01/31/fixing-the-incorrect-auto-date-and-time-on-the-iphone-4/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 23:42:43 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://36flavours.com/?p=759</guid>
		<description><![CDATA[If you are having problems with your iPhone 4 displaying the incorrect date and time when using the &#8220;Set Automatic&#8221; option, there are a number of possible solutions that could fix the problem. The issue in my case seemed to &#8230; <a href="http://stv.whtly.com/2011/01/31/fixing-the-incorrect-auto-date-and-time-on-the-iphone-4/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are having problems with your iPhone 4 displaying the incorrect date and time when using the &#8220;Set Automatic&#8221; option, there are a number of possible solutions that could fix the problem.</p>
<p>The issue in my case seemed to be caused by the the phone shutting down automatically due to an empty battery, although there may be other causes.<span id="more-759"></span></p>
<p>Having searched the web for a solution, there are a number of possible ways to fix the issue, with many appearing to work in some cases but not others:</p>
<ul>
<li>Simply turning &#8220;<em>Set Automatically</em>&#8221; to <strong>OFF</strong> then back <strong>ON</strong>.</li>
<li>Going to <em>Utilities &gt; Clock</em> and removing the World clocks, then switch the phone off and on again.</li>
<li>Hard rebooting the phone by holding down the home and on / off button at the same time (until the Apple logo appears).</li>
</ul>
<p>For me the problem was solved by carrying out the following actions:</p>
<ol>
<li>Go to <em>Settings &gt; General &gt; Date &amp; Time</em>.</li>
<li>Turn the &#8220;<em>Set Automatically</em>&#8221; option to <strong>OFF</strong></li>
<li>Plug the phone into your computer and <strong>sync</strong> it using iTunes.</li>
<li>Go back to the Date &amp; Time options page and switch &#8220;<em>Set Automatically</em>&#8221; back to <strong>ON</strong>.</li>
</ol>
<p>You may have to try a combination of the methods listed above, or if you have an alternative solution to the problem then let us all know.</p>
]]></content:encoded>
			<wfw:commentRss>http://stv.whtly.com/2011/01/31/fixing-the-incorrect-auto-date-and-time-on-the-iphone-4/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
	</channel>
</rss>

