<?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>sanchothefat.com &#187; Code</title>
	<atom:link href="http://sanchothefat.com/code/feed" rel="self" type="application/rss+xml" />
	<link>http://sanchothefat.com</link>
	<description>is Robert O&#039;Rourke, a front-end web developer from Liverpool</description>
	<lastBuildDate>Thu, 03 Mar 2011 17:56:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Hacking the WordPress comment form</title>
		<link>http://sanchothefat.com/code/176/hacking-the-wordpress-comment-form</link>
		<comments>http://sanchothefat.com/code/176/hacking-the-wordpress-comment-form#comments</comments>
		<pubDate>Sat, 20 Mar 2010 18:30:50 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://sanchothefat.com/?p=176</guid>
		<description><![CDATA[In the pursuit of a decent comment form for my blog I&#8217;ve tried at least 5 different form plugins over the years but my favourite solution is always going to be to use the wordpress comments form. The comment form makes sense to me because: it is protected by akismet; generally you only need the [...]]]></description>
			<content:encoded><![CDATA[<p>In the pursuit of a decent comment form for my blog I&#8217;ve tried at least 5 different form plugins over the years but my favourite solution is always going to be to use the wordpress comments form.</p>
<p><span id="more-176"></span></p>
<p>The comment form makes sense to me because:</p>
<ul>
<li> it is protected by akismet;</li>
<li>generally you only need the name, email and comment field;</li>
<li>All your form responses are emailed to you and a record is kept in your database.</li>
</ul>
<h2>How do you do it?</h2>
<p><em>I&#8217;m assuming a general knowledge of wordpress templates here so let me know in the comments of you want further clarification.</em> After looking through the file wp_comments_post.php I noticed that it looks for a post parameter called &#8216;redirect_to&#8217; that isn&#8217;t present in the regular comment form. I added the following hidden field to a copy of the comments form I made on a custom page template:</p>
<pre>&lt;input type="hidden" name="redirect_to" value="/contact?success" /&gt;
</pre>
<p>The end result is that a form submission will return to my contact page but with the added query string in the <abbr>URL</abbr>. I then check for the query string in the template using <abbr>PHP</abbr> to show a thank you message in place of the form.</p>
<pre>&lt;?php if ( isset($_GET['success']) ) { ?&gt;

   ... show thank you message ...

&lt;?php } else { ?&gt;

   ... show comment form ...

&lt;?php } ?&gt;
</pre>
<p>There are some caveats to this approach:</p>
<ul>
<li>No real error handling as the comments list isn&#8217;t written out so javascript validation is required.</li>
<li>If you are displaying recent comments you will need to block &#8216;comments&#8217; made on the contact page from showing up.</li>
</ul>
<p>Those problems may be deal breakers for you &#8211; especially the error handling but until I find (or write) the prefect contact form plugin this is the approach that works for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://sanchothefat.com/code/176/hacking-the-wordpress-comment-form/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cross Browser CSS Image Replacement on Inputs</title>
		<link>http://sanchothefat.com/code/99/cross-browser-css-image-replacement-on-inputs</link>
		<comments>http://sanchothefat.com/code/99/cross-browser-css-image-replacement-on-inputs#comments</comments>
		<pubDate>Mon, 01 Mar 2010 00:35:19 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://www.sanchothefat.com/blog/?p=99</guid>
		<description><![CDATA[Disclaimer: I know image replacement isn&#8217;t ideal but sometimes we have to do it, plus it does offer up the opportunity for rollover effects using sprite backgrounds without javascript (at least in IE7+). Here&#8217;s a quick solution to the problem of using regular CSS image replacement on inputs. The text-indent method fails in IE so [...]]]></description>
			<content:encoded><![CDATA[<p><em>Disclaimer: I know image replacement isn&#8217;t ideal but sometimes we have to do it, plus it does offer up the opportunity for rollover effects using sprite backgrounds without javascript (at least in <abbr title="Internet Explorer 7">IE7</abbr>+).</em></p>
<p>Here&#8217;s a quick solution to the problem of using regular <abbr>CSS</abbr> image replacement on inputs. The text-indent method fails in <abbr title="Internet Explorer">IE</abbr> so we need a slightly different approach.</p>
<p><span id="more-99"></span></p>
<p><strong><abbr title="Hypertext Markup Language">HTML</abbr>:</strong></p>
<pre>&lt;input type="submit" class="submit" /&gt;
</pre>
<p><strong><abbr>CSS</abbr>:</strong></p>
<pre>input.submit {
  display: inline-block;
  background: url(submit.png) no-repeat left top;
  width: 120px; // match width of background image
  height: 40px; // match height of background image
  text-indent: -9999px;
}</pre>
<p>Because IE screws this up by not acknowledging the text-indent rule we need to take another approach. If text-indent is the horizontal approach to hiding text for small objects it made sense to try hiding the text vertically using line-height.</p>
<p><strong><abbr>CSS</abbr> take 2:</strong></p>
<pre>input.submit {
  display: block;
  background: url(submit.png) no-repeat left top;
  width: 120px;
  height: 40px;
  line-height: 100px; // must be at least the font-size plus the button height
  overflow: hidden; // only show what is within the desired dimensions
}</pre>
<p>So there you go. The downside is that you have to use display: block; on the input. Usually this won&#8217;t be much of an issue however if you have multiple submit buttons or links next to the buttons then you&#8217;ll have to get your float on.</p>
]]></content:encoded>
			<wfw:commentRss>http://sanchothefat.com/code/99/cross-browser-css-image-replacement-on-inputs/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

