<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>nick boldison</title>
	
	<link>http://nick.boldison.com</link>
	<description>Freelance Web Developer, Yorkshire</description>
	<lastBuildDate>Thu, 08 Mar 2012 13:29:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/NickBoldison" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="nickboldison" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>WordPress : How to have query search posts only</title>
		<link>http://nick.boldison.com/wordpress/wordpress-how-to-have-query-search-posts-only/</link>
		<comments>http://nick.boldison.com/wordpress/wordpress-how-to-have-query-search-posts-only/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 13:28:40 +0000</pubDate>
		<dc:creator>Nick Boldson</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[search posts]]></category>

		<guid isPermaLink="false">http://nick.boldison.com/?p=700</guid>
		<description><![CDATA[If you need to have your WordPress search only search posts for results, you can insert this code before the &#8216;if(have_posts()):&#8217; line on search.php and it will do that for you. // search only posts global $wp_query; $args = array_merge( $wp_query-&#62;query, array( 'post_type' =&#62; 'post' ) ); query_posts( $args ); Further to that you can [...]]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script>
<p>If you need to have your WordPress search only search posts for results, you can insert this code before the &#8216;if(have_posts()):&#8217; line on search.php and it will do that for you.</p>
<p><pre class="brush: php">// search only posts
global $wp_query;
$args = array_merge( $wp_query-&gt;query, array( 'post_type' =&gt; 'post' ) );
query_posts( $args ); </pre></p>
<p>Further to that you can add any arguments from the standard W<a href="http://codex.wordpress.org/Class_Reference/WP_Query" target="_blank">P_Query function</a> to there to make the search more custom <img src='http://nick.boldison.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://nick.boldison.com/wordpress/wordpress-how-to-have-query-search-posts-only/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress : TinyMCE text editor shortcuts</title>
		<link>http://nick.boldison.com/wordpress/wordpress-tinymce-text-editor-shortcuts/</link>
		<comments>http://nick.boldison.com/wordpress/wordpress-tinymce-text-editor-shortcuts/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 20:26:51 +0000</pubDate>
		<dc:creator>Nick Boldson</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://nick.boldison.com/?p=692</guid>
		<description><![CDATA[Some useful shortcuts for the TinyMCE editor in WordPress...]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script>
<p>Some useful shortcuts for the TinyMCE editor in WordPress&#8230;</p>
<table>
<tbody>
<tr>
<th>Action</th>
<th>Windows</th>
<th>Mac</th>
</tr>
<tr>
<td>Insert a link</td>
<td>Alt + Shift + A</td>
<td>Option + Shift + A</td>
</tr>
<tr>
<td>Apply a blockquote</td>
<td>Alt + Shift + Q</td>
<td>Option + Shift + Q</td>
</tr>
<tr>
<td>Unordered list item</td>
<td>Alt + Shift + U</td>
<td>Option + Shift + U</td>
</tr>
<tr>
<td>Ordered list item</td>
<td>Alt + Shift + O</td>
<td>Option + Shift + O</td>
</tr>
<tr>
<td>Left align</td>
<td>Alt + Shift + L</td>
<td>Option + Shift + L</td>
</tr>
<tr>
<td>Center align</td>
<td>Alt + Shift + C</td>
<td>Option + Shift + C</td>
</tr>
<tr>
<td>Right align</td>
<td>Alt + Shift + R</td>
<td>Option + Shift + R</td>
</tr>
<tr>
<td>Switch to HTML mode</td>
<td>Alt + Shift + E</td>
<td>Option + Shift + E</td>
</tr>
<tr>
<td>Insert &lt;!&#8211;more&#8211;&gt;</td>
<td>Alt + Shift + T</td>
<td>Option + Shift + T</td>
</tr>
<tr>
<td>Show full toolbar</td>
<td>Alt + Shift + Z</td>
<td>Option + Shift + Z</td>
</tr>
<tr>
<td>Full screen mode</td>
<td>Alt + Shift + G</td>
<td>Option + Shift + G</td>
</tr>
<tr>
<td>New paragraph</td>
<td>Ctrl + P</td>
<td>Command + P</td>
</tr>
<tr>
<td>Copy</td>
<td>Ctrl + C</td>
<td>Command + C</td>
</tr>
<tr>
<td>Paste</td>
<td>Ctrl + P</td>
<td>Command + P</td>
</tr>
<tr>
<td>Bold</td>
<td>Ctrl + B</td>
<td>Command + B</td>
</tr>
<tr>
<td>Italic</td>
<td>Ctrl + I</td>
<td>Command + I</td>
</tr>
<tr>
<td>Underline</td>
<td>Ctrl + U</td>
<td>Command + U</td>
</tr>
<tr>
<td>New heading H1-H6</td>
<td>Ctrl + 1-6</td>
<td>Command + 1-6</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://nick.boldison.com/wordpress/wordpress-tinymce-text-editor-shortcuts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Robotic curtain</title>
		<link>http://nick.boldison.com/blog/robotic-curtain/</link>
		<comments>http://nick.boldison.com/blog/robotic-curtain/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 13:33:32 +0000</pubDate>
		<dc:creator>Nick Boldson</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://nick.boldison.com/?p=203</guid>
		<description><![CDATA[Everyone should have one of these...]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script>
<p>Everyone should have one of these&#8230;</p>
<p><iframe width="648" height="359" src="http://www.youtube.com/embed/rKhbUjVyKIc" frameborder="0" allowfullscreen></iframe></p>
<p>Read more about it here: <a href="http://www.niklasroy.com/project/88/my-little-piece-of-privacy" target="_blank">http://www.niklasroy.com/project/88/my-little-piece-of-privacy</a></p>
]]></content:encoded>
			<wfw:commentRss>http://nick.boldison.com/blog/robotic-curtain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get your latest Tweet using the JSON timeline</title>
		<link>http://nick.boldison.com/websites/javascript/get-your-latest-tweet-using-the-json-timeline/</link>
		<comments>http://nick.boldison.com/websites/javascript/get-your-latest-tweet-using-the-json-timeline/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 17:35:55 +0000</pubDate>
		<dc:creator>Nick Boldson</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://nick.boldison.com/?p=646</guid>
		<description><![CDATA[There are a few ways in which I have seen to get the latets Tweet from Twitter to display on a site. The easiest solution I have found uses the JSON timeline of Tweets. In the example below, I have used this method and formatted the tweets into a list. It can then be styled [...]]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
<p>There are a few ways in which I have seen to get the latets Tweet from Twitter to display on a site. The easiest solution I have found uses the JSON timeline of Tweets.</p>
<p>In the example below, I have used this method and formatted the tweets into a list. It can then be styled how you like from there.</p>
<h2>The Javascript</h2>
<p><pre class="brush: js">function twitterCallback2(twitters) {
  var statusHTML = [];
  for (var i=0; i&lt;twitters.length; i++){
    var username = twitters[i].user.screen_name;
    var status = twitters[i].text.replace(/((https?|s?ftp|ssh)://[^&quot;s&lt;&gt;]*[^.,;'&quot;&gt;:s&lt;&gt;)]!])/g, function(url) {
      return '&lt;a href=&quot;'+url+'&quot;&gt;'+url+'&lt;/a&gt;';
    }).replace(/B@([_a-z0-9]+)/ig, function(reply) {
      return  reply.charAt(0)+'&lt;a href=&quot;http://twitter.com/'+reply.substring(1)+'&quot;&gt;'+reply.substring(1)+'&lt;/a&gt;';
    });
    statusHTML.push('&lt;li&gt;&lt;span&gt;'+status+'&lt;/span&gt; &lt;a style=&quot;font-size:85%&quot; href=&quot;http://twitter.com/'+username+'/statuses/'+twitters[i].id_str+'&quot;&gt;' + relative_time(twitters[i].created_at)+'&lt;/a&gt;&lt;/li&gt;');
  }
  jQuery('.twitter_update_list').html(statusHTML.join(''));
}

function relative_time(time_value) {
  var values = time_value.split(&quot; &quot;);
  time_value = values[1] + &quot; &quot; + values[2] + &quot;, &quot; + values[5] + &quot; &quot; + values[3];
  var parsed_date = Date.parse(time_value);
  var relative_to = (arguments.length &gt; 1) ? arguments[1] : new Date();
  var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
  delta = delta + (relative_to.getTimezoneOffset() * 60);

  if (delta &lt; 60) {
    return 'less than a minute ago';
  } else if(delta &lt; 120) {
    return 'about a minute ago';
  } else if(delta &lt; (60*60)) {
    return (parseInt(delta / 60)).toString() + ' minutes ago';
  } else if(delta &lt; (120*60)) {
    return 'about an hour ago';
  } else if(delta &lt; (24*60*60)) {
    return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';
  } else if(delta &lt; (48*60*60)) {
    return '1 day ago';
  } else {
    return (parseInt(delta / 86400)).toString() + ' days ago';
  }
}</pre><br />
The twitterCallback2() function formats the Tweets nicely for you and uses the relative_time() function to get the time it was created and display that.</p>
<h2>The HTML</h2>
<p>Below is the HTML you should use to display the Tweets. If you want more than 1, simply change the value of &#8216;count&#8217; so it is greater.</p>
<p><pre class="brush: xml">&lt;ul class=&quot;twitter_update_list&quot;&gt;
	&lt;li&gt;Tweets will replace this...&lt;/li&gt;
&lt;/ul&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://twitter.com/statuses/user_timeline/captain_nick.json?callback=twitterCallback2&amp;amp;count=2&quot;&gt;&lt;/script&gt;
&lt;p&gt;Follow &lt;a href=&quot;http://twitter.com/#!/captain_nick&quot; target=&quot;_blank&quot;&gt;@captain_nick&lt;/a&gt;&lt;/p&gt;</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://nick.boldison.com/websites/javascript/get-your-latest-tweet-using-the-json-timeline/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress : The proper way to create a home page template that isn’t the standard list of blog articles</title>
		<link>http://nick.boldison.com/wordpress/wordpress-the-proper-way-to-create-a-home-page-template-that-isnt-the-standard-list-of-blog-articles/</link>
		<comments>http://nick.boldison.com/wordpress/wordpress-the-proper-way-to-create-a-home-page-template-that-isnt-the-standard-list-of-blog-articles/#comments</comments>
		<pubDate>Sun, 27 Mar 2011 16:23:08 +0000</pubDate>
		<dc:creator>Nick Boldson</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://nick.boldison.com/?p=485</guid>
		<description><![CDATA[A quick guide to correctly set WordPress up to have a custom home page template.]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
<p>For a while I used to hack around themes to get a home page that had a different look to the standard list of blog articles that you see and created a blog page elsewhere to handle that. It was messy and evidently the incorrect way to go about things. I know WordPress for being flexible and having thought of most circumstances of what people want to do, so I figured the must be a proper way to do it.</p>
<h2>New home page</h2>
<p>Create a page using a text editor and name it something like main.php. This will be the new home page.<br />
Below is the general code you would add when creating a home page that isn&#8217;t a list of blog posts. essentially, it&#8217;s just a replica of the code used when creating a custom <a href="http://codex.wordpress.org/Pages#Page_Templates" target="_blank">page template</a>.<br />
<pre class="brush: php">&lt;?php
/**
 * Template Name: Home
 *
 * @package WordPress
 * @subpackage Theme Name
 */

get_header(); ?&gt;

&lt;?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?&gt;
		
		&lt;h1&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;

                &lt;?php if(has_post_thumbnail()){ ?&gt;
			&lt;?php the_post_thumbnail('home'); ?&gt;
		&lt;?php } ?&gt;
        
		&lt;div id=&quot;content&quot;&gt;
		
			&lt;?php the_content(); ?&gt;
		
		&lt;/div&gt;
		
&lt;?php endwhile; // end of the loop. ?&gt;
		
&lt;?php get_footer(); ?&gt;</pre><br />
Make sure that the &#8216;Template Name: Home&#8217; is at the top of the file as WordPress will read this when checking for page templates. Once done, upload it to the theme folder on you site and in the admin, create a page called something like &#8216;Home&#8217;. In the right column, you should see a box named &#8216;Page Attributes&#8217;. Select the&#8217;Home&#8217; template and save the page.</p>
<h2>Blog home page</h2>
<p>We don&#8217;t need to create a custom php file for the blog page as we will just be using the standard index.php as that&#8217;s what it&#8217;s there for! All we need to do is create a page in the WordPress admin and name it something like &#8216;Blog&#8217;. Just whatever you want the slug to be really for the blog list page. Don&#8217;t select a template for this page, just leave it as default.</p>
<h2>Setting it all up&#8230;</h2>
<p>All that needs to be done now is to set up the theme so that the home page and blog page do what you want them to. Go to Settings -&gt; Reading in your WordPress admin.<br />
For the option &#8216;Front end display&#8217;, check &#8216;A static page (select below)&#8217; . Now for the &#8216;Front page&#8217; dropdown, select &#8216;Home&#8217; or whetever you named the home page and &#8216;Blog&#8217; for the &#8216;Posts page&#8217; dropdown.</p>
<p><img class="alignnone size-full wp-image-492" title="Screen shot 2011-03-27 at 16.58.51" src="http://nick.boldison.com/wp-content/uploads/2011/03/Screen-shot-2011-03-27-at-16.58.511.png" alt="" width="444" height="295" /></p>
<p>Now if you go to the home page of your theme, it should display the home page we just created. Obviously you can add anything to that main.php to make it as creative as you like. Just add the blog link in to get to that and it will be found at the URL you set it to when adding the &#8216;Blog&#8217; page in the admin.</p>
<p>Here is an exmaple of a site I did this with recently that has a cusotm home page and the blog page linked at the top: <a href="http://dinosaurpr.co.uk/" target="_blank">http://dinosaurpr.co.uk/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://nick.boldison.com/wordpress/wordpress-the-proper-way-to-create-a-home-page-template-that-isnt-the-standard-list-of-blog-articles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress : Creating a Twitter Widget</title>
		<link>http://nick.boldison.com/wordpress/wordpress-creating-a-twitter-widget/</link>
		<comments>http://nick.boldison.com/wordpress/wordpress-creating-a-twitter-widget/#comments</comments>
		<pubDate>Sun, 05 Dec 2010 13:05:03 +0000</pubDate>
		<dc:creator>Nick Boldson</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://nick.boldison.com/?p=474</guid>
		<description><![CDATA[A guide on how to create a fairly flexible Twitter widget for your site or themes you build.]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
<p>Here is an easy way to create a fairly customisable Twitter Widget for your WordPress blog. For the following, we need to add the code to the functions.php file within the root of your theme&#8217;s file.</p>
<h3>1. The Widget</h3>
<p>Firstly, you need to create the function for the actual widget. The function here uses a Twitter Widget to display the latest tweets from your account. You can change certain variables in here as you wish, such as the background colour and the text colour.<br />
<pre class="brush: php">&lt;?php

function twitter_widget()
{
    $settings = get_option(&quot;widget_twitter&quot;);

    $twitter_id = $settings['twitter_id'];
    $twitter_width = $settings['twitter_width'];
    $twitter_height = $settings['twitter_height'];

    echo &quot;&lt;div class=&quot;widget&quot;&gt;
    &lt;h1 class=&quot;side_nav_title&quot;&gt;Follow us on Twitter&lt;/h1&gt;
	&lt;script src=&quot;http://widgets.twimg.com/j/2/widget.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
	new TWTR.Widget({
	version: 2,
	type: 'profile',
	rpp: 3,
	interval: 6000,
	width: &quot;.$twitter_width.&quot;,
	height: &quot;.$twitter_height.&quot;,
	theme: {
	shell: {
	background: '#F3F3F3',
	color: '#232323'
	},
	tweets: {
	background: '#F3F3F3',
	color: '#232323',
	links: '#f9a424'
	}
	},
	features: {
	scrollbar: false,
	loop: false,
	live: false,
	hashtags: true,
	timestamp: true,
	avatars: false,
	behavior: 'all'
	}
	}).render().setUser('&quot;.$twitter_id.&quot;').start();
	&lt;/script&gt;
	&lt;/div&gt;&quot;;
}

?&gt;</pre></p>
<h3>2. The Twitter Widget admin</h3>
<p>Next, we create the admin for the widget; this is what appears once we drag the widget into a sidebar and WordPress gives us a list of options for it.<br />
Here we are creating options for the Twitter username, width and height of the box. You could also add in the colours for the background and text if you wish, just add in extra ones like in the example below.<br />
<pre class="brush: php">&lt;?php

function twitter_widget_admin() {

	$settings = get_option(&quot;widget_twitter&quot;);
	
	// update options
	if (isset($_POST['update_twitter'])) {
	
		$settings['twitter_id'] = strip_tags(stripslashes($_POST['twitter_id']));
		$settings['twitter_width'] = strip_tags(stripslashes($_POST['twitter_width']));
		$settings['twitter_height'] = strip_tags(stripslashes($_POST['twitter_height']));
		
		update_option(&quot;widget_twitter&quot;,$settings);
	}

	echo '&lt;p&gt;
	&lt;label for=&quot;twitter_id&quot;&gt;Twitter Name:
	&lt;input id=&quot;twitter_id&quot; name=&quot;twitter_id&quot; type=&quot;text&quot; class=&quot;widefat&quot; value=&quot;'.$settings['twitter_id'].'&quot; /&gt;&lt;/label&gt;&lt;/p&gt;';
	echo '&lt;p&gt;
	&lt;label for=&quot;twitter_width&quot;&gt;Width:
	&lt;input id=&quot;twitter_width&quot; name=&quot;twitter_width&quot; type=&quot;text&quot; class=&quot;widefat&quot; value=&quot;'.$settings['twitter_width'].'&quot; /&gt;&lt;/label&gt;&lt;/p&gt;';
	echo '&lt;p&gt;
	&lt;label for=&quot;twitter_height&quot;&gt;Height:
	&lt;input id=&quot;twitter_height&quot; name=&quot;twitter_height&quot; type=&quot;text&quot; class=&quot;widefat&quot; value=&quot;'.$settings['twitter_height'].'&quot; /&gt;&lt;/label&gt;&lt;/p&gt;';
	echo '&lt;input type=&quot;hidden&quot; id=&quot;update_twitter&quot; name=&quot;update_twitter&quot; value=&quot;1&quot; /&gt;';

}

?&gt;</pre></p>
<h3>3. Registering the Widget</h3>
<p>Now all that is left to do is to register the widget this is done with the following 2 lines of code.<br />
<pre class="brush: php">&lt;?php

register_sidebar_widget('Twitter Widget', 'twitter_widget');
register_widget_control('Twitter Widget', 'twitter_widget_admin');

?&gt;</pre></p>
<h3>4. Using the Widget</h3>
<p>Now to use this widget and add it to one of your sidebar menus go to Appearance -&gt; Widgets in your WordPress admin and it will be available to add to your sidebars with the title &#8216;Twitter Widget&#8217;. Once you drag it to your sidebar, it will give the options which you can manage. Simply add your Twitter username, the width it should be and the height the box should be. Now the widget should appear on the front end of your site in the sidebar you put it in.</p>
<h3>5. Full code</h3>
<p>Below is the full code for creating the Twitter Widget. Simply add it to your functions.php file in your theme folder.<br />
<pre class="brush: php">&lt;?php

function twitter_widget()
{
    $settings = get_option(&quot;widget_twitter&quot;);

    $twitter_id = $settings['twitter_id'];
    $twitter_width = $settings['twitter_width'];
    $twitter_height = $settings['twitter_height'];

    echo &quot;&lt;div class=&quot;widget&quot;&gt;
    &lt;h1 class=&quot;side_nav_title&quot;&gt;Follow us on Twitter&lt;/h1&gt;
	&lt;script src=&quot;http://widgets.twimg.com/j/2/widget.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
	new TWTR.Widget({
	version: 2,
	type: 'profile',
	rpp: 3,
	interval: 6000,
	width: &quot;.$twitter_width.&quot;,
	height: &quot;.$twitter_height.&quot;,
	theme: {
	shell: {
	background: '#F3F3F3',
	color: '#232323'
	},
	tweets: {
	background: '#F3F3F3',
	color: '#232323',
	links: '#f9a424'
	}
	},
	features: {
	scrollbar: false,
	loop: false,
	live: false,
	hashtags: true,
	timestamp: true,
	avatars: false,
	behavior: 'all'
	}
	}).render().setUser('&quot;.$twitter_id.&quot;').start();
	&lt;/script&gt;
	&lt;/div&gt;&quot;;
}

function twitter_widget_admin() {

	$settings = get_option(&quot;widget_twitter&quot;);
	
	// update options
	if (isset($_POST['update_twitter'])) {
	
		$settings['twitter_id'] = strip_tags(stripslashes($_POST['twitter_id']));
		$settings['twitter_width'] = strip_tags(stripslashes($_POST['twitter_width']));
		$settings['twitter_height'] = strip_tags(stripslashes($_POST['twitter_height']));
		
		update_option(&quot;widget_twitter&quot;,$settings);
	}

	echo '&lt;p&gt;
	&lt;label for=&quot;twitter_id&quot;&gt;Twitter Name:
	&lt;input id=&quot;twitter_id&quot; name=&quot;twitter_id&quot; type=&quot;text&quot; class=&quot;widefat&quot; value=&quot;'.$settings['twitter_id'].'&quot; /&gt;&lt;/label&gt;&lt;/p&gt;';
	echo '&lt;p&gt;
	&lt;label for=&quot;twitter_width&quot;&gt;Width:
	&lt;input id=&quot;twitter_width&quot; name=&quot;twitter_width&quot; type=&quot;text&quot; class=&quot;widefat&quot; value=&quot;'.$settings['twitter_width'].'&quot; /&gt;&lt;/label&gt;&lt;/p&gt;';
	echo '&lt;p&gt;
	&lt;label for=&quot;twitter_height&quot;&gt;Height:
	&lt;input id=&quot;twitter_height&quot; name=&quot;twitter_height&quot; type=&quot;text&quot; class=&quot;widefat&quot; value=&quot;'.$settings['twitter_height'].'&quot; /&gt;&lt;/label&gt;&lt;/p&gt;';
	echo '&lt;input type=&quot;hidden&quot; id=&quot;update_twitter&quot; name=&quot;update_twitter&quot; value=&quot;1&quot; /&gt;';

}

register_sidebar_widget('Twitter Widget', 'twitter_widget');
register_widget_control('Twitter Widget', 'twitter_widget_admin');

?&gt;</pre></p>
<p>Depending upon your styling and the CSS you use on your site, it should create a widget in your sidebar like this.</p>
<p style="text-align: center;"><img class="size-full wp-image-476 aligncenter" title="Picture 1" src="http://nick.boldison.com/wp-content/uploads/2010/12/Picture-1.png" alt="" width="319" height="351" /></p>
]]></content:encoded>
			<wfw:commentRss>http://nick.boldison.com/wordpress/wordpress-creating-a-twitter-widget/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>WordPress : Redirecting to a random page</title>
		<link>http://nick.boldison.com/wordpress/wordpress-redirecting-to-a-random-page/</link>
		<comments>http://nick.boldison.com/wordpress/wordpress-redirecting-to-a-random-page/#comments</comments>
		<pubDate>Sun, 05 Dec 2010 12:13:29 +0000</pubDate>
		<dc:creator>Nick Boldson</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://nick.boldison.com/?p=468</guid>
		<description><![CDATA[How to create a random redirect using the wp_redirect() function built into WordPress.]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
<p>To create a random redirect in WordPress, you need to query your posts and get a random post ID and then use wp_redirect() function in WordPress to redirect users away to that page.</p>
<p>&nbsp;</p>
<p>Additionally if the redirect is a 301, you can add a status to the wp_redirect() function in the following way.</p>
<p>&nbsp;</p>
<p>The default value if left empty is 302.</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.boldison.com/wordpress/wordpress-redirecting-to-a-random-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress : Creating a menu of subpages from post ID of a child page</title>
		<link>http://nick.boldison.com/wordpress/wordpress-creating-a-menu-of-subpages-from-post-id-of-a-child-page/</link>
		<comments>http://nick.boldison.com/wordpress/wordpress-creating-a-menu-of-subpages-from-post-id-of-a-child-page/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 21:18:53 +0000</pubDate>
		<dc:creator>Nick Boldson</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://nick.boldison.com/?p=459</guid>
		<description><![CDATA[A step by step guide on how to create a menu of child pages by using the post ID of a child page.]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
<p>Below is a step by step guide on how to create a menu of child pages by using the post ID of a child page.<br />
It uses that ID to get the top parent&#8217;s slug, then the top parent&#8217;s ID and finally uses the wp_list_pages() function of WordPress to retrieve and display the list of child pages.</p>
<h3>Get slug of top parent</h3>
<p>Firstly, you need to add the function below called getTopParentPostName(). This function gets the slug of the top parent of the subpage we are on. We need this so that we can then get the ID of the</p>
<p>&nbsp;</p>
<h3>Get top parent&#8217;s ID</h3>
<p>Next we need to use the function get_ID_by_slug() to get the ID of the top parent we just found. This is so we can use the list in the array of arguments in the wp_list_pages() function in WordPress.</p>
<p>&nbsp;</p>
<h3>Displaying the child pages</h3>
<p>Finally we use create the array of arguments we want so we can compile the menu of subpages. This is done using the wp_list_pages() function and passing an array of arguments to it.</p>
<p>&nbsp;</p>
<p>The arguments I have used do the following things:</p>
<p><strong> &#8216;echo&#8217; =&gt; 1</strong> &#8211; this allows the function to echo the menu out once we call it.<br />
<strong> &#8216;title_li&#8217; =&gt; &#8221; </strong>- this just removes the title of the menu&#8230;I don&#8217;t usually fel the need to display this, that&#8217;s all.<br />
<strong> &#8216;child_of&#8217; =&gt; get_ID_by_slug(getTopParentPostName($post-&gt;ID))</strong> &#8211; this uses the post ID of the page we are on to then get the top parent slug, then the ID of that top parent. This ID is then used to get all the children of that ID for displaying in the menu.<br />
<strong> &#8216;sort_column&#8217; =&gt; &#8216;menu_order, post_title&#8217; </strong>- this is just a way to order the items in the menu. It does it by the order you gave them when adding them and then by title alphabetically.</p>
<h3>Full Whammy&#8230;</h3>
<p>So the full code you will need to add to pull out the child pages from a post ID is:</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.boldison.com/wordpress/wordpress-creating-a-menu-of-subpages-from-post-id-of-a-child-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress : How to enable multi-site in WP3</title>
		<link>http://nick.boldison.com/wordpress/wordpress-how-to-enable-multi-site-in-wp3/</link>
		<comments>http://nick.boldison.com/wordpress/wordpress-how-to-enable-multi-site-in-wp3/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 18:50:59 +0000</pubDate>
		<dc:creator>Nick Boldson</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://nick.boldison.com/?p=123</guid>
		<description><![CDATA[A step by step guide of how to enable multi-site in WordPress 3, so you can create a network of sites on the one domain.]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
<p><strong>Please note: </strong>It is always advised to back up your site before making changes such as these.</p>
<h3>1. Enabling Multi-site in your installation of WordPress</h3>
<p>To enable Multisite in WordPress 3, add the following code into the wp-config.php file in the root of your site (anywhere near the top is fine). This simply tells the WordPress installation that you wish to allow the option of creating a network of sites on the one domain.</p>
<pre>define('WP_ALLOW_MULTISITE', true);</pre>
<p>&nbsp;</p>
<h3>2. Network Settings</h3>
<p>Now go to your WordPress admin and navigate to Tools -&gt; Network (this link should have appeared upon adding the above to your config).<br />
You should be welcomed with a screen that looks like the image below.</p>
<p><img class="alignnone size-full wp-image-434" title="networksettings" src="http://nick.boldison.com/wp-content/uploads/2010/12/networksettings1.gif" alt="" width="520" height="276" /></p>
<h3>3. Sub-domains or sub-directories?</h3>
<p>Here you need to choose between using sub-domains or sub-directories when adding a new site to the domain. You can only choose one for all and it can be quite tricky to alter this once you have selected one and set it up, so <strong>choose wisely! </strong></p>
<p><strong> </strong>The obvious difference is that sub-domains displays them as blog.domain.com whereas sub-directories displays them as domain.com/blog.</p>
<p>Choosing sub-directories is the easier to do and requires no altering of your DNS, so is the best option for most people.<br />
But personally I prefer sub-domains as I think it reads better. When doing this it&#8217;s best to add <a href="http://en.wikipedia.org/wiki/Wildcard_DNS_record" target="_blank">Wildcard DNS</a> to your domain. This is so that when you add a new blog to your multi-site WordPress installation, you don&#8217;t have to add a record for that blog to your DNS each time.</p>
<h3>4. Enabling the Network</h3>
<p>Next you will be asked to choose a name for your network and the adin email address for it. Fill those in and hit &#8216;Install&#8217;.5. After the installation completes, you will be shown a page with details you need to copy and paste into your .htaccess file and the wp-config.php file. The page should look like this.</p>
<p><img class="alignnone size-medium wp-image-449" title="networksettings2" src="http://nick.boldison.com/wp-content/uploads/2010/12/networksettings22-580x481.png" alt="" width="580" height="481" /></p>
<h3>5. I&#8217;ve been logged out? <img src='http://nick.boldison.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </h3>
<p>You should find at this point that when you next click anywhere, you have been logged out. So, log in again&#8230;</p>
<h3>6. C&#8217;est tout!</h3>
<p>Basically, that&#8217;s it! Now you have done everything required to start adding multiple sites to your one installation <img src='http://nick.boldison.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Below are a few more instructions on what things do and how to add sites and enable themes and plugins on your network.</p>
<h3>Super Admin</h3>
<p>You will find that there is now a menu on the left named &#8216;Super Admin&#8217;. From here you can add new sites to your network, manage the sites within the network, manage the users throughout every site on the network, enable themes to be used throughout the network, manage various options and also update.</p>
<h3><strong>Adding a new site</strong></h3>
<p>To add a new site, simply navigate to Super Admin -&gt; Sites and scroll down to add the URL of the new site. Obviously you can only add the sub-domain/sub-directory name here and the admin email address for that site.</p>
<p>Once added, it will appear in the list above on that page. To edit the details of the domain, hover over the domain and click &#8216;Edit&#8217;, to visit the site, click &#8216;Visit&#8217; and to get into the admin for that specific site, click &#8216;Backend&#8217;.</p>
<h3><strong>Enabling themes on the network</strong></h3>
<p>Every time you add a new theme as the administrator, it will be disabled by default for users of the sites your have created to use. To let them use this, simply go to Super Admin -&gt; Themes and enable it in there.</p>
<h3><strong>Enabling plugins on the network</strong></h3>
<p>To enable sites to use plugins, you need to go to Super Admin -&gt; Options and scroll down to the very bottom until you see the checkbox title &#8216;Plugins&#8217;. Check this and update the page.</p>
<p>It&#8217;s worth taking a minute to look at all the options on this page. They give you control of various aspects of the sites in the network, such as allowing them to upload images, media, the upload limit and site space limit.</p>
<p>When you add a new plugin, you have the choice to activate it on the network or just on the site you added it to. Obviously Network Activating it means that it is activated throughout every site on the network. It&#8217;s great it that&#8217;s what you need, as you don&#8217;t have to add it and activate it manually for each one.</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.boldison.com/wordpress/wordpress-how-to-enable-multi-site-in-wp3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Show hidden files on a Mac</title>
		<link>http://nick.boldison.com/random/show-hidden-files-on-a-mac/</link>
		<comments>http://nick.boldison.com/random/show-hidden-files-on-a-mac/#comments</comments>
		<pubDate>Sun, 07 Nov 2010 14:15:31 +0000</pubDate>
		<dc:creator>Nick Boldson</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://nick.boldison.com/?p=117</guid>
		<description><![CDATA[I often need access to files such as .htaccess when programming, but they are hidden on a Mac by default. Here is a way that you can show/hide them as you wish. To view hidden files and folders: Open the Terminal (located in /Applications/Utilities/) At the command prompt type defaults write com.apple.finder AppleShowAllFiles -bool true Press [...]]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://nick.boldison.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
<p>I often need access to files such as .htaccess when programming, but they are hidden on a Mac by default. Here is a way that you can show/hide them as you wish.</p>
<p>To view hidden files and folders:</p>
<ol>
<li>Open the Terminal (located in /Applications/Utilities/)</li>
<li>At the command prompt type
<pre>defaults write com.apple.finder AppleShowAllFiles -bool true</pre>
</li>
<li>Press return to execute the command.</li>
<li>For the changes to take effect, either log out then log back in again, or relaunch Finder (this can be done from the Force Quit Window or by typing &#8216;killall Finder&#8217; in a Terminal window).</li>
</ol>
<p>To hide the hidden files again:</p>
<ol>
<li>Open the Terminal</li>
<li>At the command prompt type
<pre>defaults write com.apple.finder AppleShowAllFiles -bool false</pre>
</li>
<li>Then press return to execute the command.</li>
<li>Log out then back in again, or relaunch Finder (explained above).</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://nick.boldison.com/random/show-hidden-files-on-a-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

