<?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>36Flavours.com &#187; Blogging</title>
	<atom:link href="http://36flavours.com/category/blogging/feed/" rel="self" type="application/rss+xml" />
	<link>http://36flavours.com</link>
	<description>A taste of something different...</description>
	<lastBuildDate>Mon, 19 Apr 2010 20:01:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>An attempt to write a blog post a day for a whole year</title>
		<link>http://36flavours.com/2009/12/an-attempt-to-write-a-blog-post-a-day-for-a-whole-year/</link>
		<comments>http://36flavours.com/2009/12/an-attempt-to-write-a-blog-post-a-day-for-a-whole-year/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 12:08:18 +0000</pubDate>
		<dc:creator>Steve Whiteley</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[365]]></category>
		<category><![CDATA[challenge]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[year]]></category>

		<guid isPermaLink="false">http://36flavours.com/?p=596</guid>
		<description><![CDATA[Over the past few days I&#8217;ve been setting up a small and simple, yet long term project in which I intend to write at least one blog post a day for entire year, starting with the first post on 1st January 2010. The project preparation started on the 24th December when I registered the domain [...]]]></description>
			<content:encoded><![CDATA[<p class="first">Over the past few days I&#8217;ve been setting up a small and simple, yet long term project in which I intend to write at least one blog post a day for entire year, starting with the first post on 1st January 2010.</p>
<p>The project preparation started on the <strong>24th December</strong> when I registered the domain name <strong><a href="http://yearblog.co.uk" target="_blank">yearblog.co.uk</a></strong> <em>(a little dull, but to the point)</em>. Once that and the hosting side of things were ready I installed the latest version of WordPress (2.9) and began coming up with a few ideas for simple theme.<span id="more-596"></span></p>
<p>My initial ideas surrounded the fact that it was a year long project, so started developing designs that resembled the look and feel of a calendar. I soon got bored of this when I discovered that it was difficult to find content and navigate around, so opted for a more &#8216;traditional&#8217; approach instead.</p>
<p>I released the final theme on the site yesterday and started mentioning the idea of <strong>YearBlog</strong> on <strong><a href="http://twitter.com/36flavours" target="_blank">twitter</a></strong> and to a few friends, who decided that they may like to get in on the act and join me on this journey &#8211; good luck!</p>
<p>Luckily there is a really simple solution for allowing multiple blogs on the same domain <em>(using either sub-domains or sub-directories)</em>, in the form of <a href="http://mu.wordpress.org/" target="_blank">WordPress MU</a>. It didn&#8217;t take long until everything was up and running and I was getting ready to start blogging.</p>
<p>Although the project doesn&#8217;t actually start until the end of the week, I&#8217;ve already written two posts on the subject of preparation. To read more about the project and keep up to date with the progress, head over to my <a href="http://yearblog.co.uk/" target="_blank">YearBlog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://36flavours.com/2009/12/an-attempt-to-write-a-blog-post-a-day-for-a-whole-year/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extending the WordPress mod_rewrite rules</title>
		<link>http://36flavours.com/2009/10/extending-the-wordpress-mod_rewrite-rules/</link>
		<comments>http://36flavours.com/2009/10/extending-the-wordpress-mod_rewrite-rules/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 17:29:23 +0000</pubDate>
		<dc:creator>Steve Whiteley</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[query_vars]]></category>
		<category><![CDATA[rewrite rule]]></category>

		<guid isPermaLink="false">http://36flavours.com/?p=423</guid>
		<description><![CDATA[If you have written a WordPress Plug-in, or a highly customised page, and you want to add a custom rewrite rule then this is article is definitely the one for you. We all know that WordPress is a powerful and pretty impressive blogging platform, and contains many useful features. The problem is finding the features [...]]]></description>
			<content:encoded><![CDATA[<p class="first">If you have written a WordPress Plug-in, or a highly customised page, and you want to add a custom rewrite rule then this is article is definitely the one for you.</p>
<p>We all know that <a href="http://wordpress.org/" target="_blank">WordPress</a> is a powerful and pretty impressive blogging platform, and contains many useful features. The problem is finding the features you need / want. Most of the time they are available &#8211; <em>somewhere</em>.<span id="more-423"></span></p>
<p>In this case, after a numbers of hours research, I&#8217;ve done all the hard work for you when it comes to adding custom rewrite rules. We shall assume we have a page called &#8220;<strong>directory</strong>&#8216;&#8221; with the page ID &#8220;<strong>123</strong>&#8221; and the parent page of name &#8220;<strong>business</strong>&#8220;.</p>
<p>This page <em>(ID: 123)</em> looks for the parameter &#8220;business&#8221; and if is defined, displays the details for the corresponding company. We also want to add the location of the business in the url, but for simplicity we will not pass them through in this example.</p>
<p>The end goal is to have a list of businesses displayed on &#8220;<strong>/business/directory/</strong>&#8221; with links to the business details in the format &#8220;<strong>/business/directory/york-yo31/mybusinessltd/</strong>&#8220;.</p>
<p>To achieve this, we will need to make use of three hooks. The first is the &#8220;<a href="http://codex.wordpress.org/Plugin_API/Action_Reference" target="_blank">init</a>&#8221; hook, which we will use to regenerate the rewrite rules and save them to the database using flush_rules().</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> directory_flush_rewrite<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_rewrite</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$wp_rewrite</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush_rules</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'directory_flush_rewrite'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The second hook is &#8220;<a href="http://codex.wordpress.org/Custom_Queries" target="_blank">query_vars</a>&#8220;. This is required to add the string &#8220;business&#8221; to the list of query variables WordPress understands in order for it to be retrieved on our directory page.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> directory_vars<span style="color: #009900;">&#40;</span><span style="color: #000088;">$public_query_vars</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$public_query_vars</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'business'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$public_query_vars</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'query_vars'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'directory_vars'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The last hook is called &#8220;<a href="http://codex.wordpress.org/Function_Reference/WP_Rewrite" target="_blank">generate_rewrite_rules</a>&#8221; and allows us to add the custom rewrite rule/s the list of WordPress rewrite rules. Putting the <strong>three code snippets together</strong> will result in the following block of code, which should be added to your &#8220;<strong>functions.php</strong>&#8221; file.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> directory_flush_rewrite<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_rewrite</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$wp_rewrite</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush_rules</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'directory_flush_rewrite'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> directory_vars<span style="color: #009900;">&#40;</span><span style="color: #000088;">$public_query_vars</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$public_query_vars</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'business'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$public_query_vars</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'query_vars'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'directory_vars'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> directory_rewrite_rules<span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_rewrite</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$wp_rewrite</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">rules</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'business/directory/(?:\w+)-(?:\w+)/(.*)/?'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'index.php?page_id=123&amp;business='</span><span style="color: #339933;">.</span><span style="color: #000088;">$wp_rewrite</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">preg_index</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$wp_rewrite</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">rules</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'generate_rewrite_rules'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'directory_rewrite_rules'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The final piece of information you need is how to access the variable passed through form the rewrite rule (&#8220;<strong>business</strong>=mybusinessltd&#8221;). This can be done using using the following:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'business'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// returns 'mybusinessltd' in this example.</span></pre></div></div>

<p>The example Reg Exp used could be modified and improved nad the page name could be matched and used instead of using the page id, but should put you on the right track. As mentioned earlier, you could also pass through the the other parameters (town &amp; postcode) and use them alongside business in your lookup query.</p>
]]></content:encoded>
			<wfw:commentRss>http://36flavours.com/2009/10/extending-the-wordpress-mod_rewrite-rules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using WP-Syntax and the visual editor</title>
		<link>http://36flavours.com/2009/09/using-wp-syntax-and-the-visual-editor/</link>
		<comments>http://36flavours.com/2009/09/using-wp-syntax-and-the-visual-editor/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 20:09:40 +0000</pubDate>
		<dc:creator>Steve Whiteley</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tinymce]]></category>
		<category><![CDATA[wp-syntax]]></category>

		<guid isPermaLink="false">http://36flavours.com/?p=388</guid>
		<description><![CDATA[Many of the blog posts I write tend to be about web development related topics and will often include a number of code snippets. My current choice of syntax highlighter is WP-Syntax, which supports a wide range of popular languages and has the ability to also include line numbers. The problem with using this plug-in [...]]]></description>
			<content:encoded><![CDATA[<p class="first">Many of the blog posts I write tend to be about web development related topics and will often include a number of code snippets. My current choice of syntax highlighter is <a href="http://wordpress.org/extend/plugins/wp-syntax/" target="_blank">WP-Syntax</a>, which supports a wide range of popular languages and has the ability to also include line numbers.</p>
<p>The problem with using this plug-in is that the <a href="http://wordpress.org/" target="_blank">WordPress</a> WYSIWYG Editor (<a href="http://tinymce.moxiecode.com/" target="_blank">TinyMCE</a>), will <strong>remove any tags and attributes</strong> that it believes to be invalid according to it&#8217;s configuration. As two of the attributes used by this plug-in are custom attributes <em>(escaped/line)</em> they are removed, causing some unexpected output.<span id="more-388"></span></p>
<p>One solution to this problem is to add the custom attributes to the list of valid elements by using the &#8216;<strong>tiny_mce_before_init</strong>&#8216; filter and appending them to the &#8216;<strong>extended_valid_elements&#8217;</strong> string.</p>
<p>The function below can be added to the <em>functions.php</em> file within your theme directory:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> tinymce_wp_syntax<span style="color: #009900;">&#40;</span><span style="color: #000088;">$init</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'pre[lang|escaped=true|line]'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$init</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'extended_valid_elements'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$init</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'extended_valid_elements'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$values</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$init</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'extended_valid_elements'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">','</span><span style="color: #339933;">.</span><span style="color: #000088;">$values</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$init</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tiny_mce_before_init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'tinymce_wp_syntax'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Adding this to my blog enables me to continue using the visual editor instead of disabling it and at the same time will allow the other HTML filters to continue as normal <img src='http://36flavours.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p><strong>Note:</strong> You may have to force refresh (ctrl + f5) the post / page editing page for the changes to take effect.</p>
<p><strong>EDIT</strong>: This solution does not fully solve the problem in <a href="http://mu.wordpress.org/">WordPress MU</a> installations, as you need to adjust the allowed post tags used by the content filter.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>CUSTOM_TAGS<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$allowedposttags</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pre'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span>  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'lang'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'escaped'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'true'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'line'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://36flavours.com/2009/09/using-wp-syntax-and-the-visual-editor/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WP &#8211; Enable read more links for pages</title>
		<link>http://36flavours.com/2009/08/wp-enable-read-more-links-for-pages/</link>
		<comments>http://36flavours.com/2009/08/wp-enable-read-more-links-for-pages/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 13:11:21 +0000</pubDate>
		<dc:creator>Steve Whiteley</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[2.8.4]]></category>
		<category><![CDATA[pages]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[the_loop]]></category>

		<guid isPermaLink="false">http://36flavours.com/?p=287</guid>
		<description><![CDATA[When listing pages using the_loop(), the latest version of WordPress (2.8.4) does not allow for a &#8220;Read more&#8230;&#8221; link to be appended to a list of pages using the_content() along with the &#60;!&#8211;more&#8211;&#62; quicktag. Although it wasn&#8217;t immediately obvious to me, read more links can be enabled by over-riding the global $more variable and setting [...]]]></description>
			<content:encoded><![CDATA[<p class="first">When listing pages using <em>the_loop()</em>, the latest version of WordPress (<em>2.8.4</em>) does not allow for a &#8220;Read more&#8230;&#8221; link to be appended to a list of pages using <em>the_content()</em> along with the &lt;!&#8211;more&#8211;&gt; quicktag.</p>
<p>Although it wasn&#8217;t immediately obvious to me, read more links can be enabled by over-riding the global <em><strong>$more</strong></em> variable and setting it to <em>false</em>, <strong>before looping</strong> through the result set, for example:<span id="more-287"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$more</span><span style="color: #339933;">;</span> <span style="color: #000088;">$more</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post_type=page'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	the_content<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Read More...'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span></pre></div></div>

<p>I couldn&#8217;t actually discover why this is not the default behaviour when querying pages. There may be a good reason behind it, but in my experience I found it mildly irritating.</p>
]]></content:encoded>
			<wfw:commentRss>http://36flavours.com/2009/08/wp-enable-read-more-links-for-pages/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WP &#8211; Add class name to first paragraph in blog post</title>
		<link>http://36flavours.com/2009/08/wp-add-class-name-to-first-paragraph-in-blog-post/</link>
		<comments>http://36flavours.com/2009/08/wp-add-class-name-to-first-paragraph-in-blog-post/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 15:04:27 +0000</pubDate>
		<dc:creator>Steve Whiteley</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[formatting]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://36flavours.com/?p=273</guid>
		<description><![CDATA[When re-designing my blog I wanted to display the first paragraph of each blog post in bold text. A CSS3 selector could have been used, but wouldn&#8217;t work in older browsers such as IE6. Instead I decided to write a very simple function to add a class name to the first paragraph by filtering the [...]]]></description>
			<content:encoded><![CDATA[<p class="first">When re-designing my blog I wanted to display the <strong>first paragraph</strong> of each blog post in <strong>bold text</strong>. A CSS3 selector could have been used, but wouldn&#8217;t work in older browsers such as <strong>IE6</strong>.</p>
<p>Instead I decided to write a very simple function to add a class name to the first paragraph by filtering the content, then setting the styles accordingly in my theme CSS file.<span id="more-273"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> first_paragraph<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&lt;p([^&gt;]+)?&gt;/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;p$1 class=&quot;first&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'first_paragraph'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>By default this will append <em>class=&#8221;first&#8221;</em> to the first p tag in your post.</p>
<p>If you want to use this function on your own blog, just add it to your (or create a) <strong> functions.php</strong> file within your themes folder.</p>
]]></content:encoded>
			<wfw:commentRss>http://36flavours.com/2009/08/wp-add-class-name-to-first-paragraph-in-blog-post/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Taste of Something Different&#8230;</title>
		<link>http://36flavours.com/2009/08/a-taste-of-something-different/</link>
		<comments>http://36flavours.com/2009/08/a-taste-of-something-different/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 14:42:45 +0000</pubDate>
		<dc:creator>Steve Whiteley</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[redesign]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://36flavours.com/?p=261</guid>
		<description><![CDATA[It&#8217;s been a while since writing my last blog post back in June, but I&#8217;m pleased to be getting back into it again. One of the main reasons for for the lack of updates is due to the stack of work I&#8217;ve been attempting to get through and my attempts at redesigning the layout of [...]]]></description>
			<content:encoded><![CDATA[<p class="first">It&#8217;s been a while since writing my last blog post back in June, but I&#8217;m pleased to be getting back into it again.</p>
<p>One of the main reasons for for the lack of updates is due to the stack of work I&#8217;ve been attempting to get through and my attempts at <strong>redesigning</strong> the layout of my blog.</p>
<p>I had a couple of different concepts for the redesign, but this is the design I eventually went with.<span id="more-261"></span></p>
<p>Other ideas included a <strong>post-it note</strong> type design, where the notes were <strong>randomly placed</strong> on the screen with the ability to <strong>drag</strong> and <strong>re-organise</strong>.</p>
<p style="text-align: center;"><a href="http://36flavours.com/wp-content/uploads/2009/08/idea_one.png"><img class="size-medium wp-image-262  aligncenter" title="First Idea" src="http://36flavours.com/wp-content/uploads/2009/08/idea_one-300x203.png" alt="idea_one" width="300" height="203" /></a></p>
<p>Although I liked the idea of randomisation, after putting the design into practice <strong>it failed</strong> to fulfil it&#8217;s purpose of a blog theme. Content was difficult to get to and <strong>awkward</strong> to locate, so for this reason decided to take a different approach.</p>
<p>The <strong><a href="http://36flavours.com/wp-content/uploads/2009/08/idea_two.png" target="_blank">second design</a></strong> couldn&#8217;t be more different from the first. I decided against proceeding with this design for a number of reasons. Firstly, the length of each page would have been too long and secondly <strong>I didn&#8217;t really like it</strong>.</p>
<p>My <strong>third and final attempt</strong> was loosely based on the previous, using a <strong>single fixed width column</strong> with the sidebar below the main content. The colours were reduced to a single primary colour &#8211; orange &#8211; with white text on a dark background.</p>
<p>I felt this was going in the right direction and so continued through with the development process to create the <strong>current theme</strong>, which &#8211; to be honest &#8211; is nothing special but it&#8217;s <strong>quite clean</strong>, <strong>simple</strong> and is <strong>a bit different</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://36flavours.com/2009/08/a-taste-of-something-different/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Upgrading to WordPress 2.5.1</title>
		<link>http://36flavours.com/2008/04/upgrading-to-wordpress-251/</link>
		<comments>http://36flavours.com/2008/04/upgrading-to-wordpress-251/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 11:50:15 +0000</pubDate>
		<dc:creator>Steve Whiteley</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://sha.re.it/?p=17</guid>
		<description><![CDATA[After receiving notification of the latest WordPress release I wandered over to the WordPress Blog to see what was included in the latest version (2.5.1). Aside from what has been described as a &#8220;very important security fix&#8221; there were over 70 additional bug fixes, most of which I hadn&#8217;t come across myself although had heard [...]]]></description>
			<content:encoded><![CDATA[<p class="first"><img class="alignnone size-full wp-image-18 alignleft" style="float: left; margin-right: 10px; border: 0;" title="WordPress Icon" src="http://36flavours.com/blog/wp-content/uploads/2008/04/wordpressicon-hanttula2.gif" alt="" width="80" height="80" />After receiving notification of the latest WordPress release I wandered over to the <a title="WordPress Development Blog" href="http://wordpress.org/development/2008/04/wordpress-251/" target="_blank">WordPress Blog</a> to see what was included in the latest version (2.5.1).</p>
<p>Aside from what has been described as a &#8220;very important security fix&#8221; there were over <a title="WordPress 2.5.1 Bug Fixes" href="http://trac.wordpress.org/query?status=closed&amp;milestone=2.5.1&amp;resolution=fixed&amp;order=priority" target="_blank">70 additional bug fixes</a>, most of which I hadn&#8217;t come across myself although had heard of some troubles encountered by others.</p>
<p>Unlike my previous upgrade this time I just switched the subversion repository and ran the web based update script, shaving off an additional few minutes and therefore upgrading my install in under two minutes from start to finish!</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">svn switch http://svn.automattic.com/wordpress/tags/2.5.1/</pre></div></div>

<p>Luckily everything seems to be working fine and I have faith in the WordPress releases, but if you want to be more cautious you should probably backup your database first.</p>
<p>As Paul&#8217;s response to my previous upgrade post mentions, any web scripts can be rolled back using svn.</p>
<p>It is highly recommended that you carry out the upgrade as it is said that the vulnerability to 2.5 will be made public shortly.</p>
<p>There is also to introduction of additional security in the form of secret keys, introducing randomness into the cryptographic functions used for cookies.</p>
<p>Simply <a title="WordPress Secret Key Generator" href="http://api.wordpress.org/secret-key/1.0/" target="_blank">obtain a secret key</a> and paste the code into your wp-config.php file along with the other defined variables.</p>
]]></content:encoded>
			<wfw:commentRss>http://36flavours.com/2008/04/upgrading-to-wordpress-251/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgrading WordPress using SubVersion</title>
		<link>http://36flavours.com/2008/03/upgrading-wordpress-using-subversion/</link>
		<comments>http://36flavours.com/2008/03/upgrading-wordpress-using-subversion/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 11:52:24 +0000</pubDate>
		<dc:creator>Steve Whiteley</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://sha.re.it/?p=10</guid>
		<description><![CDATA[I have just upgraded my WordPress install to the lastest release, luckily with SubVersion the whole process can be achieved with minimum time and effort. Paul went through the upgrade steps on his blog, but thought I would go through them here as I went along. Unfortunately when I initially installed WordPress I committed it [...]]]></description>
			<content:encoded><![CDATA[<p class="first">I have just upgraded my <a title="WordPress" href="http://wordpress.org" target="_blank">WordPress</a> install to the <a title="Download WordPress" href="http://wordpress.org/download/" target="_blank">lastest release</a>, luckily with SubVersion the whole process can be achieved with minimum time and effort.</p>
<p><a title="Paul Maunders" href="http://www.pyrosoft.co.uk/blog/2007/11/18/upgrading-wordpress-with-subversion/" target="_blank">Paul</a> went through the upgrade steps on his blog, but thought I would go through them here as I went along.</p>
<p>Unfortunately when I initially installed WordPress I committed it directly to the root directory unlike the more popular location of the subdirectory /blog, but not to worry.</p>
<p>Here are the steps I followed to complete the update:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># Backup the current directory...
cp -Rp http httpBACKUP
# Create a new location for the update...
mkdir httpNEW
# Checkout the latest release from the repository...
svn co http://svn.automattic.com/wordpress/tags/2.5/ httpNEW/
# Copy across any custom changes/themes and config file...
cp -Rp http/wp-con* httpNEW/
# Copy over the .htaccess file..
cp -Rp http/.htaccess httpNEW/
# Delete the old directory...
rm -rf http
# Rename/move the update to the original location...
mv httpNEW/ http
# Switch the SubVersion Repository...
svn switch http://svn.automattic.com/wordpress/tags/2.5/
# Finally, run the browser based update script...
http://yourdomain/wp-admin/upgrade.php</pre></div></div>

<p>And that&#8217;s all there is to it really, now every time I need to update WordPress I can simply copy and paste the above commands.</p>
]]></content:encoded>
			<wfw:commentRss>http://36flavours.com/2008/03/upgrading-wordpress-using-subversion/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Becoming a Blogger</title>
		<link>http://36flavours.com/2008/03/hello-world-2/</link>
		<comments>http://36flavours.com/2008/03/hello-world-2/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 20:07:29 +0000</pubDate>
		<dc:creator>Steve Whiteley</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[fubra]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://sha.re.it/?p=1</guid>
		<description><![CDATA[At last I am now an official blogger according to the results from Google. define: blogger &#8211; &#8220;The author of a blog&#8221;. Over at Fubra they like to encourage &#8211; or nag &#8211; all employees to write their own blog and be part of the ever increasing population of online bloggers. Until now I have [...]]]></description>
			<content:encoded><![CDATA[<p class="first">At last I am now an official blogger according to the results from <a title="Googles results for define: blogger" href="http://www.google.co.uk/search?q=define%3A+blogger" target="_blank">Google</a>.</p>
<blockquote><p>define: blogger &#8211; &#8220;The author of a blog&#8221;.</p></blockquote>
<p>Over at <a title="Fubra Limited" href="http://www.fubra.com" target="_blank">Fubra</a> they like to encourage &#8211; or nag &#8211; all employees to write their own blog and be part of the ever increasing population of online bloggers.</p>
<p>Until now I have been putting off the process of setting up my own blog in the hope that one would just magically appear or allow me to create one with minimum effort.</p>
<p>Thanks to the wonders of <a title="Subversion - A version control system" href="http://subversion.tigris.org/" target="_blank">Subversion</a> and <a title="WordPress - A state-of-the-art semantic personal publishing platform" href="http://wordpress.org/" target="_blank">WordPress</a> I was able to quickly and easily install a blog on my vserver that Fubra have kindly supplied.</p>
<p>It can&#8217;t really get much easier than running the following cmd to checkout from the WordPress repository:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">svn co http://svn.automattic.com/wordpress/branches/2.3/ .</pre></div></div>

<p>All that was left was to come up with a quick and simple design to get away from the default template theme.</p>
<p>So there you have it, the kick start to my future in blogging.</p>
<p>Oh, and a quick thank you to my boss <a title="Paul Maunders Web log" href="http://www.pyrosoft.co.uk/blog/">Paul</a> for backing me into a corner and pressuring me into this whole blogging malarkey.</p>
]]></content:encoded>
			<wfw:commentRss>http://36flavours.com/2008/03/hello-world-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
