<?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>Paulund</title>
	<atom:link href="http://www.paulund.co.uk/feed" rel="self" type="application/rss+xml" />
	<link>http://www.paulund.co.uk</link>
	<description>Paulund &#124; PHP Developer Bristol</description>
	<lastBuildDate>Sat, 18 May 2013 11:03:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Multi Environment WordPress wp-config.php</title>
		<link>http://www.paulund.co.uk/multi-environment-wordpress-wp-config-php</link>
		<comments>http://www.paulund.co.uk/multi-environment-wordpress-wp-config-php#comments</comments>
		<pubDate>Thu, 16 May 2013 08:12:29 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[environment]]></category>

		<guid isPermaLink="false">http://www.paulund.co.uk/?p=7209</guid>
		<description><![CDATA[<p>When you are developing any website you will always have different environments for your website, the number of environments you need will depend on the size of the project and how many people are involved in the project. The main environments you will find in any website project are: Development Server - The developers local [...]</p><p>This article was originally published on <a href="http://www.paulund.co.uk/multi-environment-wordpress-wp-config-php">Multi Environment WordPress wp-config.php</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></description>
				<content:encoded><![CDATA[<p>When you are developing any website you will always have different environments for your website, the number of environments you need will depend on the size of the project and how many people are involved in the project.</p>
<p>The main environments you will find in any website project are:</p>
<ul>
<li>Development Server - The developers local machine to development the website.</li>
<li>Testing Server - Once development is finished this will be where all testing takes place.</li>
<li>User Acceptance Testing Server - Where the client will review the changes to the website.</li>
<li>Production Server - The live website.</li>
</ul>
<p>The two environments you will <strong>always</strong> need to have is a <a href="http://www.paulund.co.uk/wordpress-developer-plugin" title="WordPress Developer Plugin" target="_blank">development environment</a> and a production environment. You will normally only have these two environments if the client doesn't need to view the site before it goes live. This means that once the developer has finished working on the site they can simply put this onto the production server. These are normally for the very basic of projects where the developer can simply test on their local development server before going live.<br />
<span id="more-7209"></span><br />
If you have a client that needs to review your development before the site goes live then you have a <strong>user acceptance testing server (UAT server)</strong>, this environment should match the production server as close as possible. When the developer has finished testing locally then they can upload the site to the <a href="http://www.paulund.co.uk/useful-websites-to-analysis-your-website" title="Useful Websites To Analysis Your Website" target="_blank">UAT server for the client to review</a>. Once the user has accepted the changes made by the developer then the site can be moved to the <strong>production site</strong>.</p>
<p>For multiple developer projects there will be a need for you to have an additional testing server inbetween development and UAT. You need this server because as the developer is creating the website and checking in the code to <a href="http://www.paulund.co.uk/learn-how-to-use-git" title="Learn How To Use Git" target="_blank">source control</a> they will only be testing on their own environment, over time this environment could become out of step with the other developers environments. Once the developer has checked in their code to source control they should then deploy this to the testing server. This is where all the developers will push their changes so it can be <a href="http://www.paulund.co.uk/test-driven-development-with-php" title="Test Driven Development With PHP" target="_blank">tested with all the other developer changes</a>. Once this server is stable and has past testing then you can push these changes to the UAT server, where the client will review these changes and if accepted will be pushed to the production server.</p>
<h2>Multi Environment With WordPress</h2>
<p>If you have a <strong>WordPress project</strong> then you want to make it easy to switch between different environments, the easiest way is to allow you to upload everything to do with your project to the server. This will mean that all the changes you make will be uploaded not just the changes to your plugins or themes. But if you upload everything you will also upload the wp-config.php file, this file will tell WordPress how to connect to the underlining database.</p>
<p>The wp-config.php file is just a PHP file so you can change it to get the credentials for the database depending on what server it is being served from, simply by using the $_SERVER global variable to differ the environments.</p>
<p>The variables you need to change between environments are:</p>
<ul>
<li><strong>DB_NAME</strong> - Name of the database</li>
<li><strong>DB_USER</strong> - User to connect to the database</li>
<li><strong>DB_PASSWORD</strong> - Password to conenct to the database</li>
<li><strong>DB_HOST</strong> - The host name of the database</li>
<li><strong>WP_HOME</strong> - The location of the WordPress Home URL</li>
<li><strong>WP_SITEURL</strong> - <a href="http://www.paulund.co.uk/override-wordpress-site-url-with-wp-config-php" title="Override WordPress Site URL With wp-config.php" target="_blank">The location of the WordPress Site URL, most of the time for will be the same as WP_HOME</a> depending on if WordPress is installed in a sub-directory.</li>
<li><strong>WP_DEBUG</strong> - To display an PHP errors or warnings.</li>
<li><strong>WP_CACHE</strong> - To cache the WordPress output.</li>
</ul>
<pre><code>&lt;?php
if( stristr( $_SERVER['SERVER_NAME'], "dev" ) ) {
 	// Dev Environment
	define( 'DB_NAME', 'project_dev' );
	define( 'DB_USER', 'project_dev_user' );
	define( 'DB_PASSWORD', 'password' );
	define( 'DB_HOST', 'localhost' );
	define( 'WP_HOME', 'http://project.dev');
	define( 'WP_SITEURL', WP_HOME);
	// Dev will always want debug on and caching off
	define( 'WP_DEBUG', true );
	define( 'WP_CACHE', false );
} elseif( stristr( $_SERVER['SERVER_NAME'], "test" ) ) {
	// Test Environment
	define( 'DB_NAME', 'project_test' );
	define( 'DB_USER', 'project_test_user' );
	define( 'DB_PASSWORD', 'password' );
	define( 'DB_HOST', 'localhost' );
	define( 'WP_HOME', 'http://project.test');
	define( 'WP_SITEURL', WP_HOME);
	// Testing will always want debug on and caching off
	define( 'WP_DEBUG', true);
	define( 'WP_CACHE', false);
} elseif( stristr( $_SERVER['SERVER_NAME'], "uat" ) ) {
	// UAT Environment
	define( 'DB_NAME', 'project_uat' );
	define( 'DB_USER', 'project_uat_user' );
	define( 'DB_PASSWORD', 'password' );
	define( 'DB_HOST', 'localhost' );
	define( 'WP_HOME', 'http://project.uat');
	define( 'WP_SITEURL', WP_HOME);
	// UAT Environment will always be the same as production so turn off debug and turn on caching
	define( 'WP_DEBUG', false );
	define( 'WP_CACHE', true );	
} else {
	// Production Environment
	define( 'DB_NAME', 'project_live' );
	define( 'DB_USER', 'project_live_user' );
	define( 'DB_PASSWORD', 'password' );
	define( 'DB_HOST', 'localhost' );
	define( 'WP_HOME', 'http://project.com');
	define( 'WP_SITEURL', WP_HOME); 
	// Live Environment will always be the same as production so turn off debug and turn on caching
	define( 'WP_DEBUG', false );
	define( 'WP_CACHE', true );
}
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
?&gt;</code></pre>
<p>This article was originally published on <a href="http://www.paulund.co.uk/multi-environment-wordpress-wp-config-php">Multi Environment WordPress wp-config.php</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.paulund.co.uk/multi-environment-wordpress-wp-config-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Flip Boards</title>
		<link>http://www.paulund.co.uk/css-flip-boards</link>
		<comments>http://www.paulund.co.uk/css-flip-boards#comments</comments>
		<pubDate>Wed, 15 May 2013 08:03:41 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Flip]]></category>
		<category><![CDATA[Transform]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://www.paulund.co.uk/?p=7081</guid>
		<description><![CDATA[<p>In this tutorial we are going to create a flip board effect by using CSS, there are 2 effects we can create one the hover event we are going to have one board flip on the horizontal and another board which will flip on the vertical. This effect can be used to hide content from [...]</p><p>This article was originally published on <a href="http://www.paulund.co.uk/css-flip-boards">CSS Flip Boards</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></description>
				<content:encoded><![CDATA[<p>In this tutorial we are going to create a flip board effect by using CSS, there are 2 effects we can create one the hover event we are going to have one board flip on the horizontal and another board which will flip on the vertical.</p>
<p>This effect can be used to hide content from the user until they hover over the board this will then display the hidden board.</p>
<p><img src="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/wp-content/uploads/2013/04/front-board.png" alt="front board" width="204" height="204" class="aligncenter size-large wp-image-7135" /></p>
<p><img src="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/wp-content/uploads/2013/04/flipped-board.png" alt="flipped board" width="204" height="204" class="aligncenter size-full wp-image-7133" /></p>
<p>View the demo to see the effect.</p>
<p><a href="http://www.paulund.co.uk/playground/demo/css-flip-board/" class="button" target="_blank">Demo</a><br />
<span id="more-7081"></span><br />
There are a number of CSS3 properties we need to use to achieve this effect.</p>
<ul>
<li><a href="http://www.w3.org/TR/css3-transforms/#backface-visibility-property" target="_blank">backface-visibility</a></li>
<li><a href="http://www.w3.org/TR/css3-transitions/#transitions" target="_blank">transition</a></li>
<li><a href="http://www.w3.org/TR/css3-transforms/#transform-property" target="_blank">transform</a></li>
<li><a href="http://www.w3.org/TR/css3-transforms/#transform-style-property" target="_blank">transform-style</a></li>
</ul>
<h2>The HTML</h2>
<p>First we start off with the HTML for the boards. Each board is made up of a div element with another 2 div elements inside, these are elements we are going to use as the front board and the flipped board.</p>
<pre><code>&lt;div class="flip-boards"&gt;
&lt;div class="board top"&gt;
&lt;div class="front"&gt;
&lt;h2&gt;Front Board&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="flipped"&gt;
&lt;h2&gt;Flipped Board&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</code></pre>
<h2>Styling The Boards</h2>
<p>To create the effect of the flipped board we are first going to style the boards.</p>
<pre><code>.flip-boards .board
{
	float:left;
	margin: 2em 8em;
	position: relative;
	width: 200px;
	height: 200px;
	cursor: pointer;
}
.flip-boards .board div
{
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    border: 1px solid #ccc;
}</code></pre>
<p>This will style the boards the same size and will position them in the same space so that they overlap each other.</p>
<p>You can change the background of the boards to make it easier to see the difference between the two boards.</p>
<pre><code>.flip-boards .board .front
{
	color:#eee;
	background: rgb(207,231,250);
	background: -moz-linear-gradient(top,  rgba(207,231,250,1) 0%, rgba(99,147,193,1) 100%);
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(207,231,250,1)), color-stop(100%,rgba(99,147,193,1)));
	background: -webkit-linear-gradient(top,  rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%);
	background: -o-linear-gradient(top,  rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%);
	background: -ms-linear-gradient(top,  rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%);
	background: linear-gradient(to bottom,  rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%);
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cfe7fa', endColorstr='#6393c1',GradientType=0 );
}
.flip-boards .board .flipped
{
	color:#555;
	background: rgb(238,238,238);
	background: -moz-linear-gradient(top,  rgba(238,238,238,1) 0%, rgba(238,238,238,1) 100%);
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(238,238,238,1)), color-stop(100%,rgba(238,238,238,1)));
	background: -webkit-linear-gradient(top,  rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%);
	background: -o-linear-gradient(top,  rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%);
	background: -ms-linear-gradient(top,  rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%);
	background: linear-gradient(to bottom,  rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%);
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#eeeeee',GradientType=0 );
}</code></pre>
<p>With the flip board we need to hide the second board from view until it can be flipped around to see it. For this we use the CSS property <strong>backface-visibility</strong>, this property is related to the <a href="http://www.paulund.co.uk/css-animate-effects-we-can-learn-from-animate-css" title="CSS Animate Effects We Can Learn From Animate.css" target="_blank">3D transforms</a> of the element. Using <strong>3D transforms</strong> you can flip an element on the y-axis so that the front of the element is now facing in the opposite direction. Using the <strong>backface-visibility</strong> you can hide any elements that are not facing the front of the screen.</p>
<pre><code>.flip {
  -webkit-transform: rotateY(180deg);
  -moz-transform: rotateY(180deg);
  -ms-transform: rotateY(180deg);
  transform: rotateY(180deg);
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility:    hidden;
  -ms-backface-visibility:     hidden;
  backface-visibility:     hidden;
}</code></pre>
<p>This code <a href="http://www.paulund.co.uk/css3-spinning-social-media-icons" title="CSS3 Spinning Social Media Icons" target="_blank">spins the element 180 degrees</a> so that the front is now facing away from screen and now the element can be hidden by using the <strong>backface-visibility</strong> property. Now we can add this to our page by using the following CSS.</p>
<pre><code>.flip-boards .board div
{
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    border: 1px solid #ccc;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility:    hidden;
    -ms-backface-visibility:     hidden;
    backface-visibility:         hidden;
}
.flip-boards .board.top .flipped
{
	-webkit-transform: rotateX( 180deg );
	-moz-transform: rotateX( 180deg );
	-ms-transform: rotateX( 180deg );
	transform: rotateX( 180deg );
}</code></pre>
<p>Now the flipped board will be hidden from view, the way we display this again is to flip the board on the hover event.</p>
<pre><code>.flip-boards .board.top:hover
{
	-webkit-transform: rotateX( 180deg );
	-moz-transform: rotateX( 180deg );
	-ms-transform: rotateX( 180deg );
	transform: rotateX( 180deg );
}</code></pre>
<p>We should also add a <a href="http://www.paulund.co.uk/link-indenting-with-css3-animation" title="Link Indenting With CSS3 Animation" target="_blank">transition effect</a> so that there is a smooth flip when rotating the board, this is done by using CSS transition, we also need to make sure that when the boards transforms it will preserve the 3D space by using the property <strong>transform-style</strong>.</p>
<pre><code>.flip-boards .board
{
	float:left;
	margin: 2em 8em;
	position: relative;
	width: 200px;
	height: 200px;
	cursor: pointer;
	-webkit-transform-style: preserve-3d;
	-moz-transform-style: preserve-3d;
	-ms-transform-style: preserve-3d;
	transform-style: preserve-3d;
	-webkit-transition: all 1s ease;
	-moz-transition: all 1s ease;
	-ms-transition: all 1s ease;
	transition: all 1s ease;
}</code></pre>
<p>That's all you need to create a flip board look which will have a hidden div which will be flipped into view when you hover over the board.</p>
<p>View the demo to see it in action.</p>
<p><a href="http://www.paulund.co.uk/playground/demo/css-flip-board/" class="button" target="_blank">Demo</a></p>
<h2>Full Code Of The Flip Board</h2>
<pre><code>&lt;div class="flip-boards"&gt;
&lt;div class="board top"&gt;
&lt;div class="front"&gt;
&lt;h2&gt;Front Board&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="flipped"&gt;
&lt;h2&gt;Flipped Board&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="board left"&gt;
&lt;div class="front"&gt;
&lt;h2&gt;Front Board&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="flipped"&gt;
&lt;h2&gt;Flipped Board&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="flip-boards"&gt;
&lt;div class="board top"&gt;
&lt;div class="front"&gt;
				&lt;img src="http://placedog.com/200/200" /&gt;
			&lt;/div&gt;
&lt;div class="flipped"&gt;
				&lt;img src="http://placekitten.com/g/200/200" /&gt;
			&lt;/div&gt;
&lt;/div&gt;
&lt;div class="board left"&gt;
&lt;div class="front"&gt;
				&lt;img src="http://placekitten.com/200/200" /&gt;
			&lt;/div&gt;
&lt;div class="flipped"&gt;
				&lt;img src="http://placedog.com/g/200/200" /&gt;
			&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</code></pre>
<pre><code>.flip-boards{ position: relative; }
.flip-boards .board
{
	float:left;
	margin: 2em 8em;
	position: relative;
	width: 200px;
	height: 200px;
	cursor: pointer;
	-webkit-transform-style: preserve-3d;
	-moz-transform-style: preserve-3d;
	-ms-transform-style: preserve-3d;
	transform-style: preserve-3d;
	-webkit-transition: all 1s ease;
	-moz-transition: all 1s ease;
	-ms-transition: all 1s ease;
	transition: all 1s ease;
}
.flip-boards .board div
{
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    border: 1px solid #ccc;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility:    hidden;
    -ms-backface-visibility:     hidden;
    backface-visibility:     hidden;
}
.flip-boards .board .front
{
	color:#eee;
	background: rgb(207,231,250); /* Old browsers */
	background: -moz-linear-gradient(top,  rgba(207,231,250,1) 0%, rgba(99,147,193,1) 100%);
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(207,231,250,1)), color-stop(100%,rgba(99,147,193,1)));
	background: -webkit-linear-gradient(top,  rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%);
	background: -o-linear-gradient(top,  rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%);
	background: -ms-linear-gradient(top,  rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%);
	background: linear-gradient(to bottom,  rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%);
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cfe7fa', endColorstr='#6393c1',GradientType=0 );
}
.flip-boards .board .flipped
{
	color:#555;
	background: rgb(238,238,238); /* Old browsers */
	background: -moz-linear-gradient(top,  rgba(238,238,238,1) 0%, rgba(238,238,238,1) 100%);
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(238,238,238,1)), color-stop(100%,rgba(238,238,238,1)));
	background: -webkit-linear-gradient(top,  rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%);
	background: -o-linear-gradient(top,  rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%);
	background: -ms-linear-gradient(top,  rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%);
	background: linear-gradient(to bottom,  rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%);
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#eeeeee',GradientType=0 );
}
.flip-boards .board h2{
	margin-top:80px;
	font-size: 1em;
}
.flip-boards .board.top:hover
{
	-webkit-transform: rotateX( 180deg );
	-moz-transform: rotateX( 180deg );
	-ms-transform: rotateX( 180deg );
	transform: rotateX( 180deg );
}
.flip-boards .board.top .flipped
{
	-webkit-transform: rotateX( 180deg );
	-moz-transform: rotateX( 180deg );
	-ms-transform: rotateX( 180deg );
	transform: rotateX( 180deg );
}
.flip-boards .board.left:hover
{
	-webkit-transform: rotateY( 180deg );
	-moz-transform: rotateY( 180deg );
	-ms-transform: rotateY( 180deg );
	transform: rotateY( 180deg );
}
.flip-boards .board.left .flipped
{
	-webkit-transform: rotateY( 180deg );
	-moz-transform: rotateY( 180deg );
	-ms-transform: rotateY( 180deg );
	transform: rotateY( 180deg );
}</code></pre>
<p>This article was originally published on <a href="http://www.paulund.co.uk/css-flip-boards">CSS Flip Boards</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.paulund.co.uk/css-flip-boards/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The HTML Email Boilerplate</title>
		<link>http://www.paulund.co.uk/html-email-boilerplate</link>
		<comments>http://www.paulund.co.uk/html-email-boilerplate#comments</comments>
		<pubDate>Fri, 10 May 2013 08:49:57 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[boilerplate]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.paulund.co.uk/?p=7381</guid>
		<description><![CDATA[<p>With web development there are lots of common tasks that we do over and over again. This is where it's helpful to work with tools that make our lives easier, this can be Server-side frameworks, HTML project boilerplates and HTML email boilerplates. Some of the most popular boilerplates you would of heard of are Twitter [...]</p><p>This article was originally published on <a href="http://www.paulund.co.uk/html-email-boilerplate">The HTML Email Boilerplate</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></description>
				<content:encoded><![CDATA[<p>With web development there are lots of common tasks that we do over and over again. This is where it's helpful to work with tools that make our lives easier, this can be Server-side frameworks, HTML project boilerplates and HTML email boilerplates. </p>
<p>Some of the most popular boilerplates you would of heard of are <a href="http://www.paulund.co.uk/twitter-bootstrap-alert-boxes" title="CSS Twitter Bootstrap Alert Boxes" target="_blank">Twitter bootstrap</a> and HTML5 boilerplate. These projects are both available on Github for you to fork and modify for your own use and both are very useful projects to use when you first start any new website project.</p>
<p>One of the problems that web developers have is getting email newsletters to look correct in most of email clients. This is where the HTML email boilerplate can be useful, it will provide you with helpful code snippets to aid in developing all your HTML emails. This will take care of the correct doctype to use, how to reset the styling to work in all clients, how to display images correctly and how to style HTML tables to align correctly in your email.</p>
<p><img src="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/wp-content/uploads/2013/05/htmlboilerplate-590x446.png" alt="htmlboilerplate" width="590" height="446" class="aligncenter size-large wp-image-7437" /></p>
<h2>HTML Doctype</h2>
<p>While many email clients will strip out the doctype, it's good practice to add a <a href="http://www.paulund.co.uk/what-is-html5" title="What Is HTML5?" target="_blank">doctype</a> so that when we are testing we know that the HTML will render correctly. When popular clients remove the doctype from the email it will be replaced by XHTML 1.0 strict doctype, this is why we make sure we set it as XHTML 1.0 strict.</p>
<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</code></pre>
<h2>Images</h2>
<p>The HTML boilerplate will help you in setting up your images correctly, if you have links around your images then a border will be placed around the images, adding these styles will remove all borders around your images.</p>
<pre><code>&lt;style&gt;
img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;} 
a img {border:none;} 
.image_fix {display:block;}
&lt;/style&gt;
&lt;img class="image_fix" src="full path to image" alt="Your alt text" title="Your title text" width="x" height="x" /&gt;</code></pre>
<h2>Tables</h2>
<p>The HTML boilerplate gives you a starting point to deal with tables, this will provide you with a starting point of defaults to use on your table to avoid any formatting problems.</p>
<pre><code>&lt;style&gt;
#backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;}
&lt;/style&gt;
&lt;table cellpadding="0" cellspacing="0" border="0" id="backgroundTable"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;table cellpadding="0" cellspacing="0" border="0" align="center"&gt;
&lt;tr&gt;
&lt;td width="200" valign="top"&gt;&lt;/td&gt;
&lt;td width="200" valign="top"&gt;&lt;/td&gt;
&lt;td width="200" valign="top"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</code></pre>
<h2>Resetting Your Styles</h2>
<p>Use the following snippet to reset the styles in the email clients, this will also help with font sizes on mobile devices.</p>
<pre><code>/* Client-specific Styles */
#outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
/* Prevent Webkit and Windows Mobile platforms from changing default font sizes, while not breaking desktop design. */
.ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} /* Force Hotmail to display normal line spacing.  More on that: http://www.emailonacid.com/forum/viewthread/43/ */
#backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;}
p { margin: 1em 0; }
/* End reset */</code></pre>
<p>Use the HTML boilerplate the next time you need to create a HTML email newsletter.</p>
<p><a href="http://htmlemailboilerplate.com/" class="button" target="_blank">HTML Email Boilerplate</a></p>
<p>This article was originally published on <a href="http://www.paulund.co.uk/html-email-boilerplate">The HTML Email Boilerplate</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.paulund.co.uk/html-email-boilerplate/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Twitter Cards To Your Website</title>
		<link>http://www.paulund.co.uk/add-twitter-cards-to-your-website</link>
		<comments>http://www.paulund.co.uk/add-twitter-cards-to-your-website#comments</comments>
		<pubDate>Wed, 08 May 2013 08:16:26 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[open graph]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.paulund.co.uk/?p=6984</guid>
		<description><![CDATA[<p>When you share a post on a social network like Facebook it will scan the URL that you are sharing and return certain information to display the page in your feed. Facebook will get the page title, page description and a thumbnail image for the page. You can change the information that Facebook gets by [...]</p><p>This article was originally published on <a href="http://www.paulund.co.uk/add-twitter-cards-to-your-website">Add Twitter Cards To Your Website</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></description>
				<content:encoded><![CDATA[<p>When you <a href="http://www.paulund.co.uk/create-your-own-share-buttons-with-sharrre" title="Create Your Own Share Buttons With Sharrre" target="_blank">share a post on a social network like Facebook</a> it will scan the URL that you are sharing and return certain information to display the page in your feed. Facebook will get the page title, page description and a thumbnail image for the page. You can change the information that Facebook gets by using the <a href="http://www.paulund.co.uk/add-facebook-open-graph-tags-to-wordpress" title="Add Facebook Open Graph Tags To WordPress" target="_blank">open graph meta tags</a>.</p>
<p>These are simply meta tags you can add to the head tag of your page, when Facebook scans your page to get the title, description and images it will search for these tags, if they are there then it will use the contents of these tags instead of the page title. These means you can fully customise the page titles just for Facebook.</p>
<p><img src="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/wp-content/uploads/2013/04/card-web-summary_0.png" alt="card-web-summary_0" width="522" height="272" class="aligncenter size-full wp-image-7021" /></p>
<p><strong>Twitter</strong> also has meta tags which you can use to customise the message on Twitter. These are called Twitter cards, it allows website owners to add more descriptive text on their links when they are shared on Twitter.<br />
<span id="more-6984"></span><br />
When a link is shared on <strong>Twitter</strong> it is limited to the 140 character limit on all tweets, but on all tweets you can expand the tweet to find out more about it. This section is where you find information on how many people have replied to the tweet, re-tweeted it and added it to their favourites. But if you have the Twitter meta tags added to your head tag then instead of just seeing the information about re-tweets and favourites you will also see a snippet of the page by showing you the title, description and an image.</p>
<p>Because you can post different types of links to Twitter like images and videos there are different types of Twitter cards you can have, one will give you a snippet of the page, another will display an image, the last one is a media play to play music or video.</p>
<p>Which type of card that is displayed can also be defined by a meta tag.</p>
<pre><code>&lt;meta name="twitter:card" content="summary"&gt;</code></pre>
<p>To display a snippet of the page the value of the content attribute will need to be <strong>summary</strong>. For an image the value will need to be changed to <strong>photo</strong>. To change this to display the media player for a video or music set the value to be <strong>player</strong>.</p>
<h2>Twitter Card Meta Tags</h2>
<p>There are different meta tags you can use depending on the type of Twitter card you are using.</p>
<h3>Summary Card</h3>
<ul>
<li>twitter:card - The card type, which will be one of "summary", "photo", or "player".</li>
<li>twitter:url - Canonical URL of the card content.</li>
<li>twitter:title - The title of your content as it should appear in the card.</li>
<li>twitter:description - A description of the content in a maximum of 200 characters.</li>
<li>twitter:image - A URL to the image representing the content.</li>
</ul>
<pre><code>&lt;meta name="twitter:card" content="summary"&gt;
&lt;meta name="twitter:site" content="@paulund_"&gt;
&lt;meta name="twitter:creator" content="@paulund_"&gt;
&lt;meta name="twitter:url" content="http://www.paulund.co.uk"&gt;
&lt;meta name="twitter:title" content="Page Title"&gt;
&lt;meta name="twitter:description" content="Page Description"&gt;
&lt;meta name="twitter:image" content="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/example-image.jpg"&gt;</code></pre>
<h3>Photo Card</h3>
<ul>
<li>twitter:card - Set this value to photo</li>
<li>twitter:url - Canonical URL of the card content.</li>
<li>twitter:title - The title of your content as it should appear in the card.</li>
<li>twitter:description - A description of the content in a maximum of 200 characters.</li>
<li>twitter:image - A URL to the image representing the content.</li>
<li>twitter:image:width - Define the original width of the image, this may not be the size Twitter use to display it but it will help twitter keep the aspect ratio of the image if it needs to resize the image.</li>
<li>twitter:image:height - Define the original height of the image.</li>
</ul>
<pre><code>&lt;meta name="twitter:card" content="photo"&gt;
&lt;meta name="twitter:site" content="@paulund_"&gt;
&lt;meta name="twitter:creator" content="@paulund_"&gt;
&lt;meta name="twitter:url" content="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/example-image.jpg"&gt;
&lt;meta name="twitter:title" content="Image Title"&gt;
&lt;meta name="twitter:description" content="Image Description"&gt;
&lt;meta name="twitter:image" content="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/example-image.jpg"&gt;
&lt;meta name="twitter:image:width" content="500"&gt;
&lt;meta name="twitter:image:height" content="500"&gt;</code></pre>
<h3>Player Card</h3>
<ul>
<li>twitter:card - Set this value to player</li>
<li>twitter:url - Canonical URL of the card content.</li>
<li>twitter:title - The title of your content as it should appear in the card.</li>
<li>twitter:description - A description of the content in a maximum of 200 characters.</li>
<li>twitter:image - A URL to the image to be used as the thumbnail of the video</li>
<li>twitter:player - The URL of the player</li>
<li>twitter:player:stream - The URL of the video to stream on the player</li>
<li>twitter:player:width - The width of the IFRAME to display the player</li>
<li>twitter:player:height - The height of the IFRAME to display the player</li>
</ul>
<pre><code>&lt;meta name="twitter:card" content="player"&gt;
&lt;meta name="twitter:site" content="@paulund_"&gt;
&lt;meta name="twitter:url" content="http://www.paulund.co.uk/example-video.mp4"&gt;
&lt;meta name="twitter:title" content="Title Of Video"&gt;
&lt;meta name="twitter:description" content="Description of the video"&gt;
&lt;meta name="twitter:image" content="http://example.com/example-video-thumbnail-image.jpg"&gt;
&lt;meta name="twitter:player" content="https://www.paulund.co.uk/example-player"&gt;
&lt;meta name="twitter:player:stream" content="http://www.paulund.co.uk/example-video.mp4"&gt;
&lt;meta name="twitter:player:width" content="500"&gt;
&lt;meta name="twitter:player:height" content="250"&gt;</code></pre>
<h2>Facebook Open Graph Tags</h2>
<p>If you are already using the Facebook open graph tags then you will have something like this in the head of your HTML.</p>
<pre><code>&lt;meta property="og:url" content="http://www.paulund.co.uk/example-url"&gt;
&lt;meta property="og:title" content="Example Title"&gt;
&lt;meta property="og:description" content="Example Description"&gt;
&lt;meta property="og:image" content="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/example-image.jpg"&gt;</code></pre>
<p>Because the <a href="http://www.paulund.co.uk/add-facebook-open-graph-tags-to-wordpress" title="Add Facebook Open Graph Tags To WordPress" target="_blank">Twitter cards meta tags were based on the open graph tags</a>, Twitter will actually use these as a fall back. It will first search for the Twitter card tags, if they are not there then it will search for the open graph tags and use them for the title, description and images. This is so you don't need to duplicate the tags with the same information as the open graph tags.</p>
<p>This means that you can have this in the head of your website and it will search work perfectly fine.</p>
<pre><code>&lt;meta name="twitter:card" content="summary"&gt;
&lt;meta name="twitter:site" content="@paulund_"&gt;
&lt;meta name="twitter:creator" content="@paulund_"&gt;
&lt;meta property="og:url" content="http://www.paulund.co.uk/example-url"&gt;
&lt;meta property="og:title" content="Example Title"&gt;
&lt;meta property="og:description" content="Example Description"&gt;
&lt;meta property="og:image" content="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/example-image.jpg"&gt;</code></pre>
<p>To view updated information about the Twitter card visit the Twitter documentation.</p>
<p><a href="https://dev.twitter.com/docs/cards" class="button" target="_blank">Twitter Cards</a></p>
<p>This article was originally published on <a href="http://www.paulund.co.uk/add-twitter-cards-to-your-website">Add Twitter Cards To Your Website</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.paulund.co.uk/add-twitter-cards-to-your-website/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.paulund.co.uk/example-video.mp4" length="0" type="video/mp4" />
		</item>
		<item>
		<title>Absolute Center Images With CSS</title>
		<link>http://www.paulund.co.uk/absolute-center-images-with-css</link>
		<comments>http://www.paulund.co.uk/absolute-center-images-with-css#comments</comments>
		<pubDate>Tue, 07 May 2013 08:06:49 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.paulund.co.uk/?p=6966</guid>
		<description><![CDATA[<p>Here is a technique about how you can absolute center position an element on the horizontal and vertical in CSS. Center Images Horizontally To center something on the horizontal in CSS it's quite easy all you need to do is set the width on the element and apply an auto margin-left and margin-right on to [...]</p><p>This article was originally published on <a href="http://www.paulund.co.uk/absolute-center-images-with-css">Absolute Center Images With CSS</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></description>
				<content:encoded><![CDATA[<p>Here is a technique about how you can absolute center position an element on the horizontal and vertical in CSS.</p>
<h2>Center Images Horizontally</h2>
<p>To center something on the horizontal in CSS it's quite easy all you need to do is set the width on the element and apply an auto margin-left and margin-right on to the image. The browser will work out the exact margin on both the right and left side of the image. This will position the image in the center of the parent element just by using the width and the margin properties.</p>
<pre><code>&lt;img src="example.html" alt="Center Images" /&gt;</code></pre>
<p><pre><code>img {
     width:250px;
     margin: 0 auto;
}</code></pre><br />
<span id="more-6966"></span></p>
<h2>Center Images On Horizontal and Vertical</h2>
<p>Setting the image to be center on the horizontal is easy you just need to set an auto on the left and right margin. But to set the image on the vertical and on the horizontal you need to set the margin on the top and left of the element.</p>
<p>The following technique is something you can use to display a pop-up window to show an image gallery in the center of the screen.</p>
<p>This example will center the image with a width of 250px, first to set the image to be absolute positioned and set the top and left property to be 50%. This will position the image in the middle of screen, but the image won't be exactly center. </p>
<pre><code>img {
   height: 250px;
   left: 50%;
   position: absolute;
   top: 50%;
   width: 250px;
}</code></pre>
<p>The top left corner of the image will be the exact center of the screen, to move this point to the center of the image we need to move the image half it's width and half it's height. To move the image on half it's width and half it's height you need to add a margin-top which is negative half the height of the image and a margin-left which is negative half the width of the image.</p>
<pre><code>img {
   height: 250px;
   left: 50%;
   margin-top: -125px;
   margin-left: -125px;
   position: absolute;
   top: 50%;
   width: 250px;
}</code></pre>
<p>This article was originally published on <a href="http://www.paulund.co.uk/absolute-center-images-with-css">Absolute Center Images With CSS</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.paulund.co.uk/absolute-center-images-with-css/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validate Featured Image On Post</title>
		<link>http://www.paulund.co.uk/check-a-featured-image-is-set-before-publishing</link>
		<comments>http://www.paulund.co.uk/check-a-featured-image-is-set-before-publishing#comments</comments>
		<pubDate>Mon, 06 May 2013 08:59:34 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.paulund.co.uk/?p=6975</guid>
		<description><![CDATA[<p>Since WordPress version 2.9 you have been able to add a post thumbnail to all your posts on your website. A post thumbnail is called a featured image for the posts, this image can be displayed in anyway you want, it is up to the theme developer. The benefit of this image is that it [...]</p><p>This article was originally published on <a href="http://www.paulund.co.uk/check-a-featured-image-is-set-before-publishing">Validate Featured Image On Post</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></description>
				<content:encoded><![CDATA[<p>Since <strong>WordPress version 2.9</strong> you have been able to <a href="http://www.paulund.co.uk/automatically-set-post-featured-image" title="Automatically Set Post Featured Image" target="_blank">add a post thumbnail</a> to all your posts on your website. A post thumbnail is called a featured image for the posts, this image can be displayed in anyway you want, it is up to the theme developer. The benefit of this image is that it allows you to add an image to a post without it appearing in the content of the actual post.</p>
<p>This will allow you to use an image to display the post instead of just the content. The main use of this image is to be used on the index page or the search results page of your WordPress site.</p>
<h2>Enable Theme Support For Featured Post</h2>
<p>By default themes do not support this feature you need to add some code to the functiona.php file.</p>
<p><pre><code>add_theme_support( 'post-thumbnails' );</code></pre><br />
<span id="more-6975"></span></p>
<h2>Set Featured Image</h2>
<p>There is a meta box on the post screen where you can set an image to be the featured image on the post.</p>
<p><img src="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/wp-content/uploads/2012/04/featured_post.png" alt="featured_post" title="featured_post" width="288" height="86" class="aligncenter size-full wp-image-5720" /></p>
<h2>Display The Featured Image</h2>
<p>To display the featured image on your WordPress theme you need to use the <strong>function the_post_thumbnail()</strong>, but first you need to check if the post currently has a thumbnail image by using the <strong>has_post_thumbnail()</strong>.</p>
<pre><code>if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
    the_post_thumbnail();
}</code></pre>
<h2>Validate Featured Image On Post</h2>
<p>If you theme requires that a post has a featured image then you need to make sure that your post has a featured image before you allow your users to publish the post.</p>
<p>If you need to validate a post you can do this on the saving the post action <strong>save_post</strong>, this action will be ran when you save the current post.</p>
<p>For us to validate this correctly we need to to check if the post has a post thumbnail by using the <strong>has_post_thumbnail() function</strong>. If the post doesn't have a post thumbnail then we need to set the post back to be a draft status and <a href="http://www.paulund.co.uk/show-urgent-messages-in-wordpress-dashboard" title="Show Urgent Messages In WordPress Dashboard" target="_blank">display an error message on the screen</a>.</p>
<h3>Validate Post Thumbnail</h3>
<p>The following code can be used to validate the post thumbnail.</p>
<p>This code will run on the <strong>save action</strong> of the post, first we check that the post type is for a post. If the post type is not a post then we return from the function so we don't continue.</p>
<p>Then we check to see if the post has a thumbnail if it doesn't have a thumbnail then we <a href="http://www.paulund.co.uk/cache-wordpress-query-strings-using-transient-api" title="Cache WordPress Query Strings Using Transient API" target="_blank">set a new transient</a> so that we can display an error message. Then we reset the post status to draft so the post doesn't displayed on the website. If the post has a thumbnail then we can just <a href="http://www.paulund.co.uk/cache-data-with-wordpress" title="How To Cache Queries In WordPress" target="_blank">delete the transient</a> so the error message isn't displayed anymore.</p>
<pre><code>add_action('save_post', 'pu_validate_thumbnail');
function pu_validate_thumbnail($post_id)
{
    // Only validate post type of post
    if(get_post_type($post_id) != 'post')
        return;
 	// Check post has a thumbnail
    if ( !has_post_thumbnail( $post_id ) ) {
    	// Confirm validate thumbnail has failed
        set_transient( "pu_validate_thumbnail_failed", "true" );
        // Remove this action so we can resave the post as a draft and then reattach the post
        remove_action('save_post', 'pu_validate_thumbnail');
        wp_update_post(array('ID' =&gt; $post_id, 'post_status' =&gt; 'draft'));
	add_action('save_post', 'pu_validate_thumbnail');
    } else {
    	// If the post has a thumbnail delete the transient
        delete_transient( "pu_validate_thumbnail_failed" );
    }
}</code></pre>
<p>Next we use the <strong>admin_notices</strong> action to display an error message if the transient is set. Once the message is displayed then we can delete the transient.</p>
<pre><code>add_action('admin_notices', 'pu_validate_thumbnail_error');
function pu_validate_thumbnail_error()
{
    // check if the transient is set, and display the error message
    if ( get_transient( "pu_validate_thumbnail_failed" ) == "true" ) {
        echo "
&lt;div id='message' class='error'&gt;
&lt;strong&gt;A post thumbnail must be set before saving the post.&lt;/strong&gt;
&lt;/div&gt;
";
        delete_transient( "pu_validate_thumbnail_failed" );
    }
}</code></pre>
<p>When you save the post and it doesn't have a featured image then you will see the post is set back to a draft and an error message is displayed on the screen.</p>
<p>This article was originally published on <a href="http://www.paulund.co.uk/check-a-featured-image-is-set-before-publishing">Validate Featured Image On Post</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.paulund.co.uk/check-a-featured-image-is-set-before-publishing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free Premium Files For May 2013</title>
		<link>http://www.paulund.co.uk/free-premium-files-for-may-2013</link>
		<comments>http://www.paulund.co.uk/free-premium-files-for-may-2013#comments</comments>
		<pubDate>Wed, 01 May 2013 18:04:23 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Freebies]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[premium]]></category>

		<guid isPermaLink="false">http://www.paulund.co.uk/?p=7419</guid>
		<description><![CDATA[<p>Each month the Envato marketplace brings you free premium standard files. Envato is a web marketplace where you can get premium files for different areas of your website. My favourite marketplaces is the script marketplace CodeCanyon and the theme marketplace ThemeForest. Here are the files which you can get for free for May 2013. PHPWebServer [...]</p><p>This article was originally published on <a href="http://www.paulund.co.uk/free-premium-files-for-may-2013">Free Premium Files For May 2013</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></description>
				<content:encoded><![CDATA[<p>Each month the Envato marketplace brings you free premium standard files.</p>
<p>Envato is a web marketplace where you can get premium files for different areas of your website. My favourite marketplaces is the script marketplace CodeCanyon and the theme marketplace ThemeForest.</p>
<p>Here are the files which you can get for free for May 2013.</p>
<h2>PHPWebServer with WebSockets Upgrade</h2>
<p><a href="http://codecanyon.net/item/phpwebserver-with-websockets-upgrade/3302946?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=nr913&#038;ref=paulund" class="noBorder" target="_blank"><img src="http://0.s3.envato.com/files/38522658/item_page_image_590x300_v1.jpg" width="590" height="300" alt="PHPWebServer with WebSockets Upgrade" class="aligncenter" /></a></p>
<p>18 purchases at the price of $5.</p>
<p>This item is a suite of PHP classes that define a HTTP web server with WebSockets upgrade possibility. It runs in PHP CLI , and you can do everything you want with it thanks to the low-end access of HTTP protocol.</p>
<p><a href="http://codecanyon.net/item/phpwebserver-with-websockets-upgrade/3302946?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=nr913&#038;ref=paulund" class="button" target="_blank">Get It Free Now</a></p>
<p><span id="more-7419"></span></p>
<h2>Skywalker - Powerful Template for Joomla!</h2>
<p><a href="http://themeforest.net/item/skywalker-powerful-template-for-joomla/479485?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=dnp_theme&#038;ref=paulund" class="noBorder" target="_blank"><img src="http://0.s3.envato.com/files/17065809/1_skywalker-template-preview.__large_preview.png" width="590" height="300" alt="Skywalker - Powerful Template for Joomla!" class="aligncenter" /></a></p>
<p>95 purchases at the price of $40.</p>
<p>The man behind the T3 Framework Wikies proudly presents Skywalker for Joomla! 2.5! My first template on Themeforest! A powerful and fully featured template and featuring all the things you need.</p>
<p>Skywalker template comes with real Quickstart Installation Pack for Joomla! 2.5 and is a unique template, with consistent typography, no one million colors or unlimited features, just simple to use features packed up and ready for you!</p>
<ul>
<li> <strong>Unique</strong>, XHTML valid and typographically <strong>consistent design</strong>.</li>
<li> <strong>Skitter Slider</strong> the best javascript based slider for Joomla!.</li>
<li> <strong>K2 Content Component</strong> used for the Blog Page.</li>
<li> <strong>GK News Show Pro</strong> with awesome styling.</li>
<li> <strong>Ajax search</strong> with awesome styling.</li>
<li> <strong>The Piecemaker 2</strong> – my own extension, the smartest out there.</li>
<li> DNP Tabs – my own smart tabs module for Joomla!, light and very easy to use.</li>
<li> Simple Blank Module – my own extension for using custom code snipets. </li>
<li> Google Maps Plugin support. </li>
<li> Custom Form Elements – another <strong>unique</strong> feature powered by CSS3 &amp; jQuery, to add more style to your checkboxes, radio boxes and select elements.</li>
<li> DNP White Social Icons – <strong>Custom Social Icons</strong> to match the template design.</li>
<li> Link Cooltips – hovering links the titles look great finally.</li>
<li> 8 styles based on beautiful colors: turquoise blue, green, orange, yellow, red, purple, magenta, grey.</li>
<li> Fullscreen Background Images with AJAX load.</li>
<li> Custom error and offline pages.</li>
<li> Beautiful CSS3 powered typography with price tables, bubbles, blockquotes, lists and everything you need for your content.</li>
<li> 30+ Module Positions on 3 very flexible desktop layouts.</li>
<li> jQuery 1.7 minimized included &amp; running in “no-conflict” mode for various template features and your code snipets. </li>
<li> Mobile Ready Layouts – reforged of course – <a href="http://skywalker.pcadviser.ro/?layouts=iphone-demo" rel="nofollow">demo here</a></li>
<li> Smooth scroll to top – a <strong>unique</strong> feature that can be used to create navigation for one page website.</li>
<li> A new Tools top panel jQuery powered easy to customize for your needs.</li>
<li> Various code snipets with the Joomla! 2.5 Quickstart </li>
<li> Automatic Adjustments to enhance template typography</li>
<li> Complete Documentation</li>
<li> Forum Support</li>
<li> That’s it ?!</li>
</ul>
<p><a href="http://themeforest.net/item/skywalker-powerful-template-for-joomla/479485?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=dnp_theme&#038;ref=paulund" class="button" target="_blank">Get It Free Now</a></p>
<h2>HIGH QUALITY - TEXT ANIMATED CONTENT AD - 300x250</h2>
<p><a href="http://activeden.net/item/high-quality-text-animated-content-ad-300x250/82002?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=wenzel&#038;ref=paulund" class="noBorder" target="_blank"><img src="http://3.s3.envato.com/files/1402453/590x300pixel.jpg" width="590" height="300" alt="HIGH QUALITY - TEXT ANIMATED CONTENT AD - 300x250" class="aligncenter" /></a></p>
<p>546 purchases at the price of $3.</p>
<p>This ist the first Series of professional Advertising Banner on activeden. You get an easy to customize 300×250px Content Ad.</p>
<p>This is just typo animation, so you can put your own logo and you own text.</p>
<p>Everything is xml based, you so can individualize this banner in the way you want without flash or actionscript knowledge.</p>
<p><a href="http://activeden.net/item/high-quality-text-animated-content-ad-300x250/82002?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=wenzel&#038;ref=paulund" class="button" target="_blank">Get It Free Now</a></p>
<h2>Determination</h2>
<p><a href="http://audiojungle.net/item/determination/724955?WT.ac=free_file&amp;WT.seg_1=free_file&amp;WT.z_author=CraigHall&amp;ref=paulund" class="noBorder" target="_blank"><img src="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/wp-content/uploads/2012/02/AudioJungle-590x311.png" alt="AudioJungle" width="590" height="311" class="aligncenter size-large wp-image-4097" /></a></p>
<p>24 purchases at the price of $13.</p>
<p>Determination is an uplifting and motivational track, designed for business or corporate projects such as presentations or advertising!</p>
<p>The track begins with a subtle, emotive piano loop that continues throughout the piece, as a staccato violin section introduces an inspiring and positive repeating pattern. A steady, punchy drum beat evolves throughout the track, while everything is held together with a simple, solid bass line and electric guitars provide a powerful chord progression throughout the piece.</p>
<p>Modern production techniques keep the track sounding fresh, and perfect for a number of uses. Includes a 320 mp3 and 16-bit wav.</p>
<p><a href="http://audiojungle.net/item/determination/724955?WT.ac=free_file&amp;WT.seg_1=free_file&amp;WT.z_author=CraigHall&amp;ref=paulund" class="button" target="_blank">Get It Free Now</a></p>
<h2>Creative Minds</h2>
<p><a href="http://videohive.net/item/creative-minds/136553?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=EFEKT_Studio&#038;ref=paulund" class="noBorder" target="_blank"><img src="http://0.s3.envato.com/files/1371784/590x300.jpg" width="590" height="300" alt="Creative Minds" class="aligncenter" /></a></p>
<p>156 purchases at the price of $20.</p>
<p>Top quality design, full customization and video instructions will help improve your styling. The best thing is that you don’t need 3rd party plug-ins.</p>
<ul>
<li>5 Image placeholders</li>
<li>11 Text placeholders</li>
<li>Logo placeholder</li>
<li>9 Background’s</li>
<li>Original sountrack, included in project!</li>
<li>Every project element customizable</li>
<li>Detailed video help</li>
<li>No plug-ins</li>
<li>Full HD – 1920×1080 – 24fps (Instructions included how to change these settings if needed)</li>
<li>Font can be downloaded free at <a href="http://www.dafont.com/geek-a-byte.font" rel="nofollow">http://www.dafont.com/geek-a-byte.font</a></li>
</ul>
<p><a href="http://videohive.net/item/creative-minds/136553?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=EFEKT_Studio&#038;ref=paulund" class="button" target="_blank">Get It Free Now</a></p>
<h2>Business eNewsletter Design</h2>
<p><a href="http://graphicriver.net/item/business-enewsletter-design/1195810?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=Alexlasek&#038;ref=paulund" class="noBorder" target="_blank"><img src="http://2.s3.envato.com/files/26333788/preview.jpg" width="590" height="1259" alt="Business eNewsletter Design" class="aligncenter" /></a></p>
<p>82 purchases at the price of $3.</p>
<ul>
<li>Fully layered 12 .PSD file</li>
<li>Easy to customize :colors, sets of news</li>
<li>Proffesional and clean style</li>
<li>Juicy colours</li>
<li>Made in <strong>6 colour</strong> versions and in 2 layout options</li>
<li>Perfect for business use like mobile apps but not only <img src="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/images/smileys/happy.png" alt=":)" title=":)"></li>
<li>Easy to code, dedicates to table or div coding  </li>
<li>All layers are fully editable and organized in groups</li>
<li>All you need to do is just change text and pictures</li>
<li>Fonts used (not included): Arial, Helvetica Neue LT Std, Helvetica Inserat LT Std</li>
</ul>
<p><a href="http://graphicriver.net/item/business-enewsletter-design/1195810?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=Alexlasek&#038;ref=paulund" class="button" target="_blank">Get It Free Now</a></p>
<h2>Lowpoly Wrench</h2>
<p><a href="http://3docean.net/item/lowpoly-wrench/4440210?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=dinhtran&#038;ref=paulund" class="noBorder" target="_blank"><img src="http://3.s3.envato.com/files/53082090/590.png" width="590" height="915" alt="Lowpoly Wrench" class="aligncenter" /></a></p>
<p>0 purchases at the price of $4.</p>
<p>This is Lowpoly Wrench, Model has 218 Tris and texture map 256-256</p>
<p><a href="http://3docean.net/item/lowpoly-wrench/4440210?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=dinhtran&#038;ref=paulund" class="button" target="_blank">Get It Free Now</a></p>
<h2>Beautiful Woman Wearing Jewellery</h2>
<p><a href="http://photodune.net/item/beautiful-woman-wearing-jewelry-very-clean-image-with-copy-space/1634933?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=matusciac&#038;ref=paulund" class="noBorder" target="_blank"><img src="http://0.s3.envato.com/files/18839896/_MG_1229.jpg" width="590" height="366" alt="beautiful woman wearing jewelry, very clean image with copy space" class="aligncenter" /></a></p>
<p>15 purchases at the price of $5.</p>
<p><a href="http://photodune.net/item/beautiful-woman-wearing-jewelry-very-clean-image-with-copy-space/1634933?WT.ac=free_file&#038;WT.seg_1=free_file&#038;WT.z_author=matusciac&#038;ref=paulund" class="button" target="_blank">Get It Free Now</a></p>
<p>This article was originally published on <a href="http://www.paulund.co.uk/free-premium-files-for-may-2013">Free Premium Files For May 2013</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.paulund.co.uk/free-premium-files-for-may-2013/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable Scroll Wheel Zoom On Google Maps</title>
		<link>http://www.paulund.co.uk/disable-scroll-wheel-zoom-on-google-maps</link>
		<comments>http://www.paulund.co.uk/disable-scroll-wheel-zoom-on-google-maps#comments</comments>
		<pubDate>Wed, 01 May 2013 07:02:13 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Map]]></category>

		<guid isPermaLink="false">http://www.paulund.co.uk/?p=7377</guid>
		<description><![CDATA[<p>When you are using the Google map API on your website it will override the the scroll mouse event and act as the zoom on the maps. This feature makes it really easy to zoom on a certain position on the map, you just hover over the location and use your mouse wheel to zoom [...]</p><p>This article was originally published on <a href="http://www.paulund.co.uk/disable-scroll-wheel-zoom-on-google-maps">Disable Scroll Wheel Zoom On Google Maps</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://btenc7unnvpdjzve.zippykid.netdna-cdn.com/wp-content/uploads/2012/01/google-map.jpg" alt="Google Map" width="462" height="300" class="aligncenter size-full wp-image-3874" /></p>
<p>When you are using the <a href="http://www.paulund.co.uk/create-google-maps-with-gmaps-js" title="Create Google Maps With gmaps.js" target="_blank">Google map API on your website</a> it will override the the scroll mouse event and act as the zoom on the maps. This feature makes it really easy to zoom on a certain position on the map, you just hover over the location and use your mouse wheel to zoom in or out. </p>
<p>But this causes a problem when you have a large or full screen map, as you scroll on the page the map will zoom out, making it difficult to scroll on the page using the mouse wheel.<br />
<span id="more-7377"></span><br />
In <a href="https://developers.google.com/maps/documentation/javascript/" target="_blank">version V3 of Google Maps API</a>, Google introduced a new parameter to turn off the mouse wheel from zooming on your map. Turning this feature off means you will now be able to scroll on the page even when your mouse is over the map. This means that the only way to zoom on your map will be to use the zoom controls on the left side of the map.</p>
<p>The parameter that you need to add to disable the scroll wheel is called <strong>scrollwheel</strong>, setting this to false will disable the feature.</p>
<pre><code>scrollwheel: false</code></pre>
<p>This parameter is defined in the maps options when you create the new map object.</p>
<pre><code>var mapOptions = {
	zoom: 10,
	mapTypeId: google.maps.MapTypeId.SATELLITE,
	scrollwheel: false
}
map = new google.maps.Map(document.getElementById("map"), mapOptions);</code></pre>
<p>This article was originally published on <a href="http://www.paulund.co.uk/disable-scroll-wheel-zoom-on-google-maps">Disable Scroll Wheel Zoom On Google Maps</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.paulund.co.uk/disable-scroll-wheel-zoom-on-google-maps/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Always Get A Checkbox $_POST Value</title>
		<link>http://www.paulund.co.uk/always-post-checkbox-value</link>
		<comments>http://www.paulund.co.uk/always-post-checkbox-value#comments</comments>
		<pubDate>Tue, 30 Apr 2013 09:19:17 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Checkbox]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.paulund.co.uk/?p=6978</guid>
		<description><![CDATA[<p>The problem with checkboxes is that if they are not checked then they are not posted with your form. If you check a checkbox and post a form you will get the value of the checkbox in the $_POST variable which you can use to process a form, if it's unchecked no value will be [...]</p><p>This article was originally published on <a href="http://www.paulund.co.uk/always-post-checkbox-value">Always Get A Checkbox $_POST Value</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></description>
				<content:encoded><![CDATA[<p>The problem with checkboxes is that if they are not checked then they are not posted with your form. If you check a checkbox and post a form you will get the value of the checkbox in the $_POST variable which you can use to process a form, if it's unchecked no value will be added to the $_POST variable.</p>
<p>In PHP you would normally get around this problem by doing an isset() check on your checkbox element. If the element you are expecting isn't set in the $_POST variable then we know that the checkbox is not checked and the value can be false.</p>
<pre><code>if(!isset($_POST['checkbox1']))
{
     $checkboxValue = false;
} else {
     $checkboxValue = $_POST['checkbox1'];
}</code></pre>
<p>But if you have created a dynamic form then you won't always know the name attribute of your checkboxes, if you don't know the name of the checkbox then you can't use the isset function to check if this has been sent with the $_POST variable.</p>
<p>To get around this problem you can <a href="http://www.paulund.co.uk/new-html5-attribute" title="Examples Of Using New HTML5 Attributes" target="_blank">use a new hidden element</a> which will store the true value of the checkbox. What you need to do is create a hidden element and use Javascript to change the value of the hidden field to the true value of the checkbox.<br />
<span id="more-6978"></span><br />
If you don't set a value of the checkbox then when the checkbox is checked and the form is submitted the value will come through as <strong>on</strong>. You can change this by setting the value attribute on your checkbox.</p>
<pre><code>&lt;input type="checkbox" name="checkbox1" value="1" /&gt;</code></pre>
<p>But because there is no unchecked value we won't know if this checkbox isn't checked. This is where the hidden element will be useful.</p>
<pre><code>&lt;input type="checkbox" name="checkbox1_checkbox" id="checkbox1_checkbox" /&gt;
&lt;input type="hidden" name="checkbox1" value="0" /&gt;</code></pre>
<p>When we submit these elements we will now always get the hidden element <strong>checkbox1</strong> but may or may not get the element <strong>checkbox1_checked</strong> depending on if the checkbox is checked. The problem we have now is that we need to find a way of changing the value in the hidden field once the checkbox has been clicked, which can be done with the following Javascript.</p>
<pre><code>$('input[type="checkbox"]').on('change', function(e){
        if($(this).prop('checked'))
        {
            $(this).next().val(1);
        } else {
            $(this).next().val(0);
        }
});</code></pre>
<p>This Javascript will be applied to all checkboxes, on the click event of each checkbox we see if the checkbox is currently checked. If it is checked then we get the next element (which should be the hidden field) and change the value to our checked value. If the checkbox is not checked then we get the hidden field and change the value to the unchecked state.</p>
<p>Now when we post the form we will always get the true checkbox value even if the checkbox isn't checked. This will allow us to create a dynamic form with checkboxes and know if they have been checked or unchecked.</p>
<p>This article was originally published on <a href="http://www.paulund.co.uk/always-post-checkbox-value">Always Get A Checkbox $_POST Value</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.paulund.co.uk/always-post-checkbox-value/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display A List Of Authors On WordPress</title>
		<link>http://www.paulund.co.uk/display-a-list-of-authors</link>
		<comments>http://www.paulund.co.uk/display-a-list-of-authors#comments</comments>
		<pubDate>Mon, 29 Apr 2013 08:23:42 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[author]]></category>
		<category><![CDATA[List]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.paulund.co.uk/?p=6940</guid>
		<description><![CDATA[<p>On some blogs it is important to post on a regular basis, but this can be difficult unless blogging is your full time job. For a single person to regularly post awesome blog posts everyday can take up a lot of time. For this reason many blogs have a number of authors, this helps keep [...]</p><p>This article was originally published on <a href="http://www.paulund.co.uk/display-a-list-of-authors">Display A List Of Authors On WordPress</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></description>
				<content:encoded><![CDATA[<p>On some blogs it is important to post on a regular basis, but this can be difficult unless blogging is your full time job.</p>
<p>For a single person to regularly post awesome blog posts everyday can take up a lot of time. For this reason many blogs have a number of authors, this helps keep the content regular and high quality to ensure a better blog.</p>
<p>On a single author blog you will normally find an about page that will tell you <a href="http://www.paulund.co.uk/how-to-display-author-bio-with-wordpress" title="How To Display Author Bio With WordPress" target="_blank">information about the author</a>. You can do this on a multi author blog but you also need to create a page that will display all the authors on the blog so you can link to each of their posts.</p>
<p>If you want to create a page to display all the authors you have two options, you can create a new page template which will allow you to code the layout of the page to show all the authors. The other option is to create a shortcode where the user of the site can use this on a new page content to create a list of all the authors.</p>
<p>The two options should be decided on if you are going to add this functionality in a plugin or a theme. If you are going to add this functionality to the theme then you should use a page template, if you want to use the shortcode then you should do this with a plugin. In this tutorial we are going to create a page template to <a href="http://www.paulund.co.uk/create-an-about-me-wordpress-widget" title="Create A Multi Author About Me WordPress Widget" target="_blank">display all the authors on the site</a>.</p>
<h2>Create A Page Template</h2>
<p>First start off by <a href="http://www.paulund.co.uk/creating-wordpress-custom-page-templates" title="Creating WordPress Custom Page Templates" target="_blank">creating a new page template</a> for your list of all authors.</p>
<pre><code>/*
Template Name: Display All Authors
*/</code></pre>
<p><span id="more-6940"></span><br />
The next thing we need to do is get a list of all users on the WordPress site that could write a post. This is all the users apart from the users with the subscriber role, the best way of getting a list of all users is to use the <a href="http://codex.wordpress.org/Function_Reference/get_users" target="_blank">function get_users()</a>. </p>
<p>This will return an array of all users on your site, it takes a number of different parameters such as:</p>
<ul>
<li> <b>blog_id</b> - The current blog's ID, unless multisite is enabled and another ID is provided</li>
<li> <b>role</b> - Limit the returned authors to the role specified.</li>
<li> <b>include</b> - An array of IDs. Only users matching these IDs will be returned.</li>
<li> <b>exclude</b> - An array of IDs. Users matching these IDs will not be returned, regardless of the other arguments.</li>
<li> <b>meta_key</b> - The <b>meta_key</b> in the wp_usermeta table for the <b>meta_value</b> to be returned.</li>
<li> <b>meta_value</b> - The value of the meta key.</li>
<li> <b>meta_compare</b> - Operator to test the '<tt>meta_value</tt>'. Possible values are '!=', '&gt;', '&gt;=', '&lt;', or '&lt;='. Default value is '='.</li>
<li> <b>meta_query</b> - A WP_Query style multiple meta_key/meta_value array.</li>
<li> <b>orderby</b> - Sort by 'ID', 'login', 'nicename', 'email', 'url', 'registered', 'display_name', or 'post_count'.</li>
<li> <b>order</b> - ASC (ascending) or DESC (descending).</li>
<li> <b>offset</b> - The first <i>n</i> users to be skipped in the returned array.</li>
<li> <b>search</b> - Use this argument to search users by email address, URL, ID or username (this <b>does not</b> currently include display name).</li>
<li> <b>number</b> - Limit the total number of users returned.</li>
<li> <b>count_total</b> - False by default. </li>
<li> <b>fields</b> - Which fields to include in the returned array. Default is "all". If set to 'all_with_meta', returns an array of WP_User objects keyed by ID.</li>
<li> <b>who</b> - If set to 'authors', only authors (user level greater than 0) will be returned.</li>
</ul>
<p>The parameters that we are going to be using is the <strong>orderby</strong> and <strong>order</strong> parameters. This is because we are going to use the <strong>orderby</strong> parameter to display the authors in order of the amount of posts they have wrote. Then we are going to use the <strong>order</strong> parameter to order the users is DESC order to display the the user with the most posts first.</p>
<p>The other parameter that we could use is the <strong>role</strong> parameter to bring a back <a href="http://www.paulund.co.uk/handling-wordpress-user-roles" title="Handling WordPress User Roles" target="_blank">users with a specific role</a>, or we can leave this blank to bring back all users. For this author list we want to display all users except for users with the subscriber role, so we are going to leave this blank and return all users.</p>
<pre><code>$allUsers = get_users('orderby=post_count&#038;order=DESC');</code></pre>
<p>As we have all the users we need to filter these and remove the users with the <strong>subscriber role</strong>, this can easily be done by looping through all the users, checking their role and creating a new array for user's which are not subscribers.</p>
<pre><code>$users = array();
// Remove subscribers from the list as they won't write any articles
foreach($allUsers as $currentUser)
{
	if(!in_array( 'subscriber', $currentUser-&gt;roles ))
	{
		$users[] = $currentUser;
	}
}</code></pre>
<p>Now we have a new $users array which is populated with all users which are not subscribers, we can now loop through this array to display each user on the page.</p>
<p>The user information we are going to display is the user name, user image, a link to all their posts, author description and links to add author meta information.</p>
<pre><code>&lt;?php
foreach($users as $user)
{
	?&gt;
&lt;div class="author"&gt;
&lt;div class="authorAvatar"&gt;&lt;/div&gt;
&lt;div class="authorInfo"&gt;
&lt;h2 class="authorName"&gt;&lt;/h2&gt;
&lt;p class="authorDescrption"&gt;&lt;/ p&gt;
&lt;p class="authorLinks"&gt;&lt;/ p&gt;
&lt;p class="socialIcons"&gt;&lt;/ p&gt;
		&lt;/div&gt;
&lt;/div&gt;
&lt;?php
}
?&gt;</code></pre>
<h2>Display Author Avatar</h2>
<p>To display the <a href="http://www.paulund.co.uk/display-gravatar-from-email-address" title="Display Gravatar From Email Address" target="_blank">author avatar we can use the author email</a> with the <a href="http://codex.wordpress.org/Function_Reference/get_avatar" target="_blank">function get_avatar()</a> to display the author avatar.</p>
<pre><code>&lt;div class="authorAvatar"&gt;
	&lt;?php echo get_avatar( $user-&gt;user_email, '128' ); ?&gt;
&lt;/div&gt;</code></pre>
<h2>Display Author Name</h2>
<p>To display the author name we can use a property value on the user object we are looping through by using <strong>$user->display_name</strong>;</p>
<pre><code>&lt;h2 class="authorName"&gt;&lt;?php echo $user-&gt;display_name; ?&gt;&lt;/h2&gt;</code></pre>
<h2>Display Author Description</h2>
<p>To display the author description we can use the <a href="http://codex.wordpress.org/Function_Reference/get_user_meta" target="_blank">function get_user_meta()</a> to get the author description.</p>
<pre><code>&lt;p class="authorDescrption"&gt;&lt;?php echo get_user_meta($user-&gt;ID, 'description', true); ?&gt;</code></pre>
<h2>Link To All Author Posts</h2>
<p>To display a link to all the author posts you can use the <a href="http://codex.wordpress.org/Function_Reference/get_author_posts_url" target="_blank">function get_author_posts_url()</a>.</p>
<pre><code>&lt;p class="authorLinks"&gt;&lt;a href="&lt;?php echo get_author_posts_url( $user-&gt;ID ); ?&gt;"&gt;View Author Links&lt;/a&gt;</code></pre>
<h2>Display Other User Meta Information</h2>
<p>You can assign new contact information to your users which you can display on the author list by using the <a href="http://codex.wordpress.org/Function_Reference/get_user_meta" target="_blank">function get_user_meta()</a>. In this tutorial we are using this function to display links to the user different social media profiles.</p>
<pre><code>&lt;p class="socialIcons"&gt;
&lt;ul&gt;
	&lt;?php
	$website = $user-&gt;user_url;
	if($user-&gt;user_url != '')
	{
		printf('
&lt;li&gt;&lt;a href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;
', $user-&gt;user_url, 'Website');
	}
	$twitter = get_user_meta($user-&gt;ID, 'twitter_profile', true);
	if($twitter != '')
	{
		printf('
&lt;li&gt;&lt;a href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;
', $twitter, 'Twitter');
	}
	$facebook = get_user_meta($user-&gt;ID, 'facebook_profile', true);
	if($facebook != '')
	{
		printf('
&lt;li&gt;&lt;a href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;
', $facebook, 'Facebook');
	}
	$google = get_user_meta($user-&gt;ID, 'google_profile', true);
	if($google != '')
	{
		printf('
&lt;li&gt;&lt;a href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;
', $google, 'Google');
	}
	$linkedin = get_user_meta($user-&gt;ID, 'linkedin_profile', true);
	if($linkedin != '')
	{
		printf('
&lt;li&gt;&lt;a href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;
', $linkedin, 'LinkedIn');
	}
?&gt;
&lt;/ul&gt;</code></pre>
<p>By putting the above code inside the loop you can display all the information you need to show your visitors all about the authors of your blog.</p>
<h2>Full Page Template</h2>
<p>Here is the full page template you can use on theme.</p>
<pre><code>&lt;?php
/*
Template Name: Display Authors
*/
// Get all users order by amount of posts
$allUsers = get_users('orderby=post_count&#038;order=DESC');
$users = array();
// Remove subscribers from the list as they won't write any articles
foreach($allUsers as $currentUser)
{
	if(!in_array( 'subscriber', $currentUser-&gt;roles ))
	{
		$users[] = $currentUser;
	}
}
?&gt;
&lt;?php get_header(); ?&gt;
&lt;section class="content" role="main"&gt;
	&lt;?php
		printf('
&lt;h1&gt;%s&lt;/h1&gt;
', the_title());
		foreach($users as $user)
		{
			?&gt;
&lt;div class="author"&gt;
&lt;div class="authorAvatar"&gt;
					&lt;?php echo get_avatar( $user-&gt;user_email, '128' ); ?&gt;
				&lt;/div&gt;
&lt;div class="authorInfo"&gt;
&lt;h2 class="authorName"&gt;&lt;?php echo $user-&gt;display_name; ?&gt;&lt;/h2&gt;
&lt;p class="authorDescrption"&gt;&lt;?php echo get_user_meta($user-&gt;ID, 'description', true); ?&gt;
&lt;p class="authorLinks"&gt;&lt;a href="&lt;?php echo get_author_posts_url( $user-&gt;ID ); ?&gt;"&gt;View Author Links&lt;/a&gt;
&lt;p class="socialIcons"&gt;
&lt;ul&gt;
							&lt;?php
								$website = $user-&gt;user_url;
								if($user-&gt;user_url != '')
								{
									printf('
&lt;li&gt;&lt;a href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;
', $user-&gt;user_url, 'Website');
								}
								$twitter = get_user_meta($user-&gt;ID, 'twitter_profile', true);
								if($twitter != '')
								{
									printf('
&lt;li&gt;&lt;a href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;
', $twitter, 'Twitter');
								}
								$facebook = get_user_meta($user-&gt;ID, 'facebook_profile', true);
								if($facebook != '')
								{
									printf('
&lt;li&gt;&lt;a href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;
', $facebook, 'Facebook');
								}
								$google = get_user_meta($user-&gt;ID, 'google_profile', true);
								if($google != '')
								{
									printf('
&lt;li&gt;&lt;a href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;
', $google, 'Google');
								}
								$linkedin = get_user_meta($user-&gt;ID, 'linkedin_profile', true);
								if($linkedin != '')
								{
									printf('
&lt;li&gt;&lt;a href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;
', $linkedin, 'LinkedIn');
								}
							?&gt;
						&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
			&lt;?php
		}
	?&gt;
&lt;/section&gt;
&lt;?php get_footer(); ?&gt;</code></pre>
<p>This article was originally published on <a href="http://www.paulund.co.uk/display-a-list-of-authors">Display A List Of Authors On WordPress</a>.

Remember Google Reader is shutting down soon, get the latest Tutorials and Snippets straight to your email <a href="http://eepurl.com/j39L1">Subscribe</a>

<a target="_blank" href="http://www.shareasale.com/r.cfm?b=430948&u=546757&m=43811&urllink=&afftrack="><img src="http://www.shareasale.com/image/43811/300x250.png" alt="Learn Web Design, Coding & much More! 100% Off First Month." border="0"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.paulund.co.uk/display-a-list-of-authors/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
