<?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>Thomas Hardy</title>
	<atom:link href="http://www.thomashardy.me.uk/feed" rel="self" type="application/rss+xml" />
	<link>http://www.thomashardy.me.uk</link>
	<description>Frontend Web Developer</description>
	<lastBuildDate>Wed, 15 May 2013 20:50:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>WordPress Word Count Function</title>
		<link>http://www.thomashardy.me.uk/wordpress-word-count-function</link>
		<comments>http://www.thomashardy.me.uk/wordpress-word-count-function#comments</comments>
		<pubDate>Wed, 15 May 2013 20:48:34 +0000</pubDate>
		<dc:creator>Thomas Hardy</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.thomashardy.me.uk/?p=188</guid>
		<description><![CDATA[A simple WordPress function to get the word count of a post.]]></description>
				<content:encoded><![CDATA[<p>Since I launched my new stripped back website I have had a few emails asking how I got the word count of each post, so I have written a quick article to show you how I do it.</p>
<p>In my functions file I have a short function:</p>
<pre>function word_count() {
    $content = get_post_field( 'post_content', $post-&gt;ID );
    $word_count = str_word_count( strip_tags( $content ) );
    return $word_count;
}</pre>
<p>This function gets the post content, using the <a href="http://codex.wordpress.org/Function_Reference/get_post_field" target="_blank">get_post_field</a> function. It then uses the str_word_count and strip_tags functions to count the words of the content with the HTML tags removed, it then returns the count.</p>
<p>I then call the function whenever I want to display the word count.</p>
<pre>echo word_count();</pre>
<p>This is a very simple function with the sole goal of displaying the word count of the current post, but it could be expanded upon very easily.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomashardy.me.uk/wordpress-word-count-function/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free Responsive HTML/CSS3 CV Template</title>
		<link>http://www.thomashardy.me.uk/free-responsive-html-css3-cv-template</link>
		<comments>http://www.thomashardy.me.uk/free-responsive-html-css3-cv-template#comments</comments>
		<pubDate>Mon, 04 Jun 2012 14:39:25 +0000</pubDate>
		<dc:creator>Thomas Hardy</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.thomashardy.me.uk/?p=141</guid>
		<description><![CDATA[A free responsive CV which uses CSS3 animations.]]></description>
				<content:encoded><![CDATA[<p>While cleaning up the folders on my home server I came across my CV and it hadn&#8217;t been updated in over two years. So I decided it was time to update it, I opened up word was ready to go when I thought why the hell did I open up word surely I can create a web based CV.</p>
<p>I decided to create a responsive CV which used CSS3 animations. After a few nights after work I had created one and put it <a href="http://www.thomashardy.me.uk/cv">online</a>, it got some great feedback and I had a few people ask me how I made it and if they could use it. So I thought the best thing to do would be to release it as a freebie.</p>
<p><a class="demo-button view-demo" title="View my CV" href="http://www.thomashardy.me.uk/cv/" target="_blank">View my CV</a> <a class="demo-button" title="Download HTML localStorage Demo" href="http://www.thomashardy.me.uk/demos/cv-template.zip">Download CV Template</a></p>
<p>This template is by no means perfect and if you do find it useful or have any ideas on how improve it then I would love to hear from you, so feel free to leave a comment.</p>
<p>If you want to be the first to know about my upcoming freebies then follow me on twitter: <a href="https://twitter.com/#!/thomasjhardy" title="Follow Thomas Hardy on Twitter">@thomasjhardy</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomashardy.me.uk/free-responsive-html-css3-cv-template/feed</wfw:commentRss>
		<slash:comments>67</slash:comments>
		</item>
		<item>
		<title>Using HTML5 localStorage on a form</title>
		<link>http://www.thomashardy.me.uk/using-html5-localstorage-on-a-form</link>
		<comments>http://www.thomashardy.me.uk/using-html5-localstorage-on-a-form#comments</comments>
		<pubDate>Sat, 03 Mar 2012 14:05:46 +0000</pubDate>
		<dc:creator>Thomas Hardy</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.thomashardy.me.uk/?p=69</guid>
		<description><![CDATA[A basic example of how to use HTML5 localStorage to store data in the users browser.]]></description>
				<content:encoded><![CDATA[<div class="post_updated">
<h3>Update &#8211; 24th April 2012</h3>
<p>Based on the great comments recieved, the demo and download files have been updated to work using .change so it works with fields which are filled via auto fill or content pasted in.
</p></div>
<p>HTML5 localStorage provides us with the ability to store named key/value pairs locally within a users browser, this means that the data stored in localStorage is still there even after a user has closed the browser, deleted their cookies or turned off their machine/device.</p>
<p>The HTML5 localStorage attribute is supported by most modern browsers including Firefox 3.5+, Chrome 4+, Safari 4+, Mobile Safari, Android 2+ and Internet Explorer 8+.</p>
<p>Now lets dive into some code and create a basic working example. In this example we are going to create a simple form which stores the data entered into the form so that if the form isn&#8217;t submitted but the browser is closed the data is still store and then retrieved when the user returns to the form.</p>
<p>So first we need a form for the user to fill in, here is the HTML for that:</p>
<pre>&lt;form id="localStorageTest" method="post" action=""&gt;
    &lt;label&gt;Name:&lt;/label&gt;
    &lt;input type="text" name="name" id="name" class="stored" value="" /&gt;

    &lt;label&gt;Email:&lt;/label&gt;
    &lt;input type="email" name="email" id="email" class="stored" value="" /&gt;

    &lt;label&gt;Message:&lt;/label&gt;
    &lt;textarea name="message" id="message" class="stored"&gt;&lt;/textarea&gt;

    &lt;input type="submit" class="demo-button" value="Submit" /&gt;
&lt;/form&gt;</pre>
<p>The main things to notice on this form is that the form elements have been given a class of stored, this will be used to allow us to specify which fields to store as you may not want to store all the data a user inputted.</p>
<p>Next up is the jQuery:</p>
<pre>&lt;script type="text/javascript"&gt;
$(document).ready(function () {
    function init() {
        if (localStorage["name"]) {
            $('#name').val(localStorage["name"]);
        }
        if (localStorage["email"]) {
            $('#email').val(localStorage["email"]);
        }
        if (localStorage["message"]) {
            $('#message').val(localStorage["message"]);
        }
    }
    init();
});

$('.stored').keyup(function () {
    localStorage[$(this).attr('name')] = $(this).val();
});

$('#localStorageTest').submit(function() {
    localStorage.clear();
});
&lt;/script&gt;</pre>
<p>OK so lets explain what is happening above, a function called init is ran when the page is first loaded. This function checks if any data is stored for each field and if so adds the data to the relevant form element.</p>
<p>Next we have the keyup function which runs when a user presses a key in any form element with the class of stored. This function then adds the inputted data into the localStorage.</p>
<p>Finally we come to submit function which when runs a user submits. This function then removes all of the data from localStorage.</p>
<p><a class="demo-button view-demo" title="View HTML5 localStorage Demo" href="http://www.thomashardy.me.uk/demos/localstorage/" target="_blank">View Demo</a> <a class="demo-button" title="Download HTML localStorage Demo" href="http://www.thomashardy.me.uk/demos/localstorage.zip">Download Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomashardy.me.uk/using-html5-localstorage-on-a-form/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>
