<?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>Xavi Esteve &#187; PHP</title>
	<atom:link href="http://xaviesteve.com/category/web-design/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://xaviesteve.com</link>
	<description>I&#039;m a front end web developer and graphic designer from Barcelona based in London. I am passionate in JavaScript, jQuery, CSS, PHP, Wordpress, usability and SEO.</description>
	<lastBuildDate>Thu, 10 May 2012 11:45:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Register in WordPress with Twitter account (plugin)</title>
		<link>http://xaviesteve.com/3128/register-in-wordpress-with-twitter-account-plugin/</link>
		<comments>http://xaviesteve.com/3128/register-in-wordpress-with-twitter-account-plugin/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 21:54:45 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[social media]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://xaviesteve.com/?p=3128</guid>
		<description><![CDATA[Wordpress Login is a WordPress plugin that will allow users to register into a WordPress website with a Twitter account in one single click. The plugin will create an account in the WordPress wp_users table. WP-Twitter-Login Who is this plugin for? This plugin has been specially coded for intermediate to senior WordPress developers that want [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-3141" title="wordpress twitter account register" src="http://xaviesteve.com/wp-content/uploads/2012/04/wordpress-twitter-account-register.jpg" alt="wordpress twitter account register" width="600" height="300" /><br />
Wordpress Login is a WordPress plugin that will allow users to register into a WordPress website with a Twitter account in one single click. The plugin will create an account in the WordPress wp_users table.</p>
<h2>WP-Twitter-Login</h2>
<h3>Who is this plugin for?</h3>
<p>This plugin has been specially coded for intermediate to senior WordPress developers that want to develop a new web application using WordPress. The plugin can be configured easily and it has been coded to be very scalable. Users with no knowledge of PHP may find other solutions more helpful since this plugin doesn&#8217;t have any GUI. The main purpose of this plugin is to allow people to develop an app taking advantage of the high-converting one-click Twitter sign-up process and saving time in programming a User Authentication system.</p>
<h3>How it works?</h3>
<p>When a user accesses the URL <code>?tw=login</code> in a WordPress website he is redirected to Twitter using Matt Harris&#8217; OAuth library. Once authenticated, a new WordPress user is created picking all the information from the Twitter username. The WordPress username has a prefix (<code>tw-</code> by default) and his Twitter ID (the public username is not used here since it can be changed). The password is his Twitter ID with a custom salt. Extra information is stored in his user profile (nickname, full name, website, bio, etc.) as well as in custom user fields (oauth_token, oauth_token_secret, language, followers and friends count, profile image, etc.).</p>
<p>A caveat in WordPress is that it requires a valid and unique email address per user. Since Twitter does not provide you with the user&#8217;s email address, the plugin registers the user with an email address like tw-twitterid@domainname.com.</p>
<p><a href="http://xaviesteve.com/wp-content/uploads/2012/04/wordpress-user-twitter.jpg"><img class="aligncenter size-large wp-image-3144" title="wordpress-user-twitter" src="http://xaviesteve.com/wp-content/uploads/2012/04/wordpress-user-twitter-600x96.jpg" alt="" width="600" height="96" /></a></p>
<p>By default the plugin will not allow users to access WP-Admin which makes this plugin perfect for someone who will provide a service to registered users without ever showing the WordPress inner pages to them. You can enable access to WP-Admin changing a variable from true to false although you should disallow users from changing their password or they will not be able to log back in.</p>
<h2>Download</h2>
<p>Download the plugin from GitHub:</p>
<p><a class="button blue" href="https://github.com/luckyshot/wp-twitter-login" rel="nofollow">wp-twitter-login</a></p>
<h3>License</h3>
<p>This plugin is licensed under a MIT license. Feel free to use it in any commercial way.</p>
<h2>Installation</h2>
<p>1. Download the plugin and upload it to your plugins folder as you would do with any other WordPress plugin</p>
<p>2. Create a new app at Twitter <a title="Create a new Twitter app" href="https://dev.twitter.com/apps/new">here</a></p>
<p>3. Copy the Consumer Key and Consumer Secret and paste them in <code>twitterlogin.php</code></p>
<p>4. Change the <code>$salt</code> variable to something long and complicated</p>
<p>5. Optionally, you can change the username prefix to something else to increase security</p>
<h2>Retrieving user information</h2>
<p>To see if a user is logged in through Twitter run <code>is_user_logged_in()</code> and then check if the username matches the Twitter prefix (<code>tw-</code> by default).</p>
<p>To retrieve the current user&#8217;s data do something like this:</p>
<pre>global $current_user;
get_currentuserinfo();
echo 'Hello ' . $current_user-&gt;nickname;
echo 'User token: ' . $current_user-&gt;oauth_token;
echo '&lt;img src="' . $current_user-&gt;profile_image_url . '" alt="" /&gt;';</pre>
<p>To retrieve data from someone else do something like this:</p>
<pre>$user_info = get_userdata($user_id);
echo 'Username: ' . $user_info-&gt;nickname;</pre>
]]></content:encoded>
			<wfw:commentRss>http://xaviesteve.com/3128/register-in-wordpress-with-twitter-account-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kohana 3.2 Documentation all-in-one PDF, ePub and HTML formats</title>
		<link>http://xaviesteve.com/2965/kohana-3-2-documentation-all-in-one-pdf-epub-and-html-formats/</link>
		<comments>http://xaviesteve.com/2965/kohana-3-2-documentation-all-in-one-pdf-epub-and-html-formats/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 12:14:54 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[kohana]]></category>
		<category><![CDATA[manual]]></category>
		<category><![CDATA[official]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://xaviesteve.com/?p=2965</guid>
		<description><![CDATA[Kohana&#8217;s official documentation is pretty complete and useful as well as well written. I have been studying it for a few days but wanted to read the tutorials also whenever I had no Internet connectivity. Searching on the Internet for PDFs or ePubs on Kohana didn&#8217;t really show much so I developed a little tool [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2982" title="Kohana ePub file" src="http://xaviesteve.com/wp-content/uploads/2012/02/kohana-epub.jpg" alt="Kohana ePub file" width="600" height="425" /></p>
<p>Kohana&#8217;s <strong>official documentation</strong> is pretty complete and useful as well as well written. I have been studying it for a few days but wanted to read the <strong>tutorials</strong> also whenever I had <strong>no Internet connectivity</strong>. Searching on the Internet for PDFs or ePubs on Kohana didn&#8217;t really show much so I developed a little tool that extracts the official documentation and outputs it in <strong>one single file</strong> so you can read the official Kohana <strong>guide</strong> anywhere anytime.</p>
<p>You can download the documentation both in <strong>ePub</strong>, <strong>PDF</strong> and <strong>HTML</strong> formats. The ePub format does not have the images in it (I used an online tool and it removed them, there aren&#8217;t a lot anyway) but works great in the iPad, Kindle and Android tablets.</p>
<p><strong><a href="http://www.mediafire.com/?ac2mebegnm0cx67" rel="nofollow">Kohana 3.2 Documentation in PDF format</a></strong> (<a href="http://min.us/mlZHsYfmD#2o">mirror</a>) (3.3MB)</p>
<p><strong><a href="http://www.mediafire.com/?u9r6clwut2g4q4e" rel="nofollow">Kohana 3.2 Documentation in ePub format</a></strong> (<a href="http://min.us/mlZHsYfmD#1o">mirror</a>) (240KB)</p>
<p><strong><a href="http://www.mediafire.com/?m5bq0p3icdqigv9" rel="nofollow">Kohana 3.2 Documentation in HTML format</a></strong> (<a href="http://min.us/mlZHsYfmD#3o">mirror</a>) (310KB)</p>
<p>I have done my best with the crawling tool but it hasn&#8217;t been 100% tested so some sections may have been skipped, please let me know in the comments if that&#8217;s the case.</p>
<p>Thanks to all the contributors to the Kohana Documentation, as I am still learning Kohana accept this as my little contribution to the framework :)</p>
]]></content:encoded>
			<wfw:commentRss>http://xaviesteve.com/2965/kohana-3-2-documentation-all-in-one-pdf-epub-and-html-formats/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iPad web based Code Editor (with extra symbols keyboard)</title>
		<link>http://xaviesteve.com/2928/ipad-web-based-code-editor-with-extra-symbols-keyboard/</link>
		<comments>http://xaviesteve.com/2928/ipad-web-based-code-editor-with-extra-symbols-keyboard/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 16:11:39 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Front-End]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://xaviesteve.com/?p=2928</guid>
		<description><![CDATA[I mostly use the iPad for reading email, news and blogs although I am still perplexed at how few apps there are for actually doing some work. Well, to be honest, there are many apps to do some work. But I believe in platform-agnostic web-apps or SAAS to be the future of our world and [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2932" title="iPad Code Editor Web Based" src="http://xaviesteve.com/wp-content/uploads/2012/02/ipad-code-editor-web-based.jpg" alt="iPad Code Editor Web Based" width="600" height="300" /></p>
<p>I mostly use the iPad for reading email, news and blogs although I am still perplexed at how few apps there are for actually doing some work. Well, to be honest, there are many apps to do some work. But I believe in platform-agnostic web-apps or SAAS to be the future of our world and the amount, variety and features of current web apps for web development is still quite scarce.</p>
<p>One of the big gaps that I found was regarding code editors. The lack of fast symbol typing in the keyboard is very frustrating and slow (you need to use iOS&#8217;s default keyboard and type 3 keys just to get a &#8220;&lt;&#8221; sign, plus another one to get back). This is why I came up with a proof of concept on<strong> additional keyboard rows with extra keys for touch screen devices</strong> and added all symbols frequently used for coding and programming so you don&#8217;t need to keep switching from one keyboard set to another. It has been optimised for the iPad in portrait mode although with some responsive CSS queries and device detection it can be adapted anywhere.</p>
<p>The code itself is basic HTML, CSS and a bit of JavaScript and jQuery. I&#8217;ve kept it simple to aid scalability and customisation. This is how it looks:</p>
<p><a href="http://xaviesteve.com/wp-content/uploads/2012/02/ipad-additional-keyboard-coding-programming-symbols.png"><img class="alignnone size-large wp-image-2929" title="iPad additional web-based keyboard for coding" src="http://xaviesteve.com/wp-content/uploads/2012/02/ipad-additional-keyboard-coding-programming-symbols-600x800.png" alt="iPad additional web-based keyboard for coding" width="600" height="800" /></a></p>
<h2>Demo and download</h2>
<p>Click the following link to open the Code Editor. To test it properly you will need an <em>iPad in portrait mode</em>.</p>
<p><a class="button blue" href="http://xaviesteve.com/pro/ipadkeyboard" target="_blank">iPad web-based code editor with extra symbols keyboard</a></p>
<h3>License</h3>
<p>Public Domain, keeping the Internet open. You can use it commercially and distribute it as much as you want without being forced to credit the author.</p>
<h3>Changelog</h3>
<p>If you have developed it further send me an email and I will include it in the next release and you in the Credits.</p>
<h4>8 February 2012 (v1.0)</h4>
<ul>
<li>First release</li>
</ul>
<p>If you haven&#8217;t seen my <a title="iPad/iPhone/mobile HTML/CSS template for web apps (responsive, no javascript)" href="http://xaviesteve.com/2899/ipad-iphone-mobile-html-css-template-for-web-apps/">iPad HTML/CSS template</a> you must see it now.</p>
]]></content:encoded>
			<wfw:commentRss>http://xaviesteve.com/2928/ipad-web-based-code-editor-with-extra-symbols-keyboard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Generate a custom/fake/virtual page on the fly &#8211; WordPress Plugin Development</title>
		<link>http://xaviesteve.com/2851/generate-a-custom-fakevirtual-page-on-the-fly-wordpress-plugin-development/</link>
		<comments>http://xaviesteve.com/2851/generate-a-custom-fakevirtual-page-on-the-fly-wordpress-plugin-development/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 21:01:10 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Front-End]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://xaviesteve.com/?p=2851</guid>
		<description><![CDATA[I&#8217;m currently developing a WordPress plugin that needs to show a virtual page generated by my plugin (such as a form or a message) and I wanted to avoid adding a new Page and modifying the current WordPress installation, so every plugin form, message or page had to be generated on the fly without touching the database. Some WordPress plugins [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://xaviesteve.com/wp-content/uploads/2011/09/wordpress-performance-speed-tips1.jpg" alt="Wordpress ultimate performance" /></p>
<p>I&#8217;m currently developing a <strong>WordPress plugin</strong> that needs to <strong>show a virtual page generated by my plugin</strong> (such as a form or a message) and I wanted to <strong>avoid adding a new Page</strong> and modifying the current WordPress installation, so every plugin form, message or page had to be <strong>generated on the fly</strong> without touching the database.</p>
<p>Some WordPress plugins or themes create new pages in the website&#8217;s installation to add advanced functionalities. As an example, WooCommerce adds new pages to the <code>wp_posts</code> database that help set up the website to work with it. In my opinion this is a mess, if you already have a WordPress website running, installing this theme/plugin will mess with your current page structures and whenever you want to uninstall it or deactivate it you will need to manually remove those pages created previously by the plugin. I once wanted to test an advanced WordPress theme that deleted all the current pages I had&#8230; that was the most annoying thing ever, since I already had written the content for the website and lost it (yes, I should have backed up but, who would expect a theme to delete and install pages without even a warning?).</p>
<p>A few weeks ago I posted <a href="http://wordpress.stackexchange.com/questions/37954/display-custom-content-using-page-php-from-theme" rel="nofollow">a question</a> in WordPress StackExchange but couldn&#8217;t really get the answer I was looking for, there was <a href="http://www.blogseye.com/2010/05/creating-fake-wordpress-posts-on-the-fly/" rel="nofollow">this</a> solution to <strong>create fake posts</strong> but I wanted generate <strong>unlimited pages</strong> with <strong>simple code</strong> as possible and using friendly URLs like: <em>http://example.com/?<strong>plugin_page=myfakepage</strong></em> (I could then easily use <code>mod_rewrite</code> to make them look even better). Today I kept investigating and finally came with the solution.</p>
<h2>Step by step guide</h2>
<p>We will load the page at http://example.com/ but modify its title, content and select a blank theme template so it looks like a complete new page.</p>
<h3>Custom page content</h3>
<p>First of all we create a function that will overwrite the content:</p>
<pre>function plugin_myown_content() {
  $return = '
&lt;p&gt;Fill in this form:&lt;/p&gt;
&lt;form action="?" method="post"&gt;
  &lt;input type="text" name="foo" value="bar" /&gt;
  &lt;input type="submit" value="Connect" /&gt;
&lt;/form&gt;
';
  return $return;
}</pre>
<h3>Custom page title</h3>
<p>Now we overwrite the title of the page with this function:</p>
<pre>function plugin_myown_title() {
  return "On the fly foobar form";
}</pre>
<h3>Default page template</h3>
<p>With this function we force WordPress to load the default page template of the current active theme:</p>
<pre>function plugin_myown_template() {
  include(TEMPLATEPATH."/page.php");
  exit;
}</pre>
<h3>Hook actions and filters</h3>
<p>Finally, we add a simple <code>if</code>to check if the user is requesting the plugin&#8217;s fake page and run WordPress hooks to load the 3 functions mentioned before and force WordPress into displaying the virtual page we have just generated.</p>
<pre>if ($_GET['plugin_page'] == "myfakepage") {
  add_filter('the_title','plugin_myown_title');
  add_filter('the_content','plugin_myown_content');
  add_action('template_redirect', 'plugin_myown_template');
}</pre>
<p>The code is pretty basic, from here you can add your desired PHP code to make it do whatever you want. You can also add more hooks to customize the page even further. I hope you get the idea. This code has been tested with the latest version of WordPress (3.3.1).</p>
]]></content:encoded>
			<wfw:commentRss>http://xaviesteve.com/2851/generate-a-custom-fakevirtual-page-on-the-fly-wordpress-plugin-development/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Quick website prototyping</title>
		<link>http://xaviesteve.com/2556/quick-website-prototyping/</link>
		<comments>http://xaviesteve.com/2556/quick-website-prototyping/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 17:35:58 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Front-End]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://xaviesteve.com/?p=2556</guid>
		<description><![CDATA[This is a little compilation I&#8217;ve made of my most used code snippets every time I build a prototype, website or theme. By following these steps you can save 80% of coding time for any HTML/CSS website or WordPress theme. For some of my projects I use the Zen Coding plugin to develop the HTML. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-large wp-image-2616" title="" src="http://xaviesteve.com/wp-content/uploads/2011/10/prototype-600x400.jpg" alt="" width="600" height="400" /></p>
<p>This is a little compilation I&#8217;ve made of my most used code snippets every time I build a prototype, website or theme. By following these steps you can save 80% of coding time for any HTML/CSS website or WordPress theme. For some of my projects I use the Zen Coding plugin to develop the HTML. Most of the CSS itself is optimized already using short names and what some people call OOCSS (Object Oriented CSS).</p>
<h2>1. CSS Reset and Minimal Grid</h2>
<h3>Yahoo CSS Reset</h3>
<pre>/* Copyright (c) 2011, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:

http://developer.yahoo.com/yui/license.html

version: 2.9.0 */
html{color:#000;background:#FFF}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,select,p,blockquote,th,td{margin:0;padding:0}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}address,button,caption,cite,code,dfn,em,input,optgroup,option,select,strong,textarea,th,var{font:inherit}del,ins{text-decoration:none}li{list-style:none}caption,th{text-align:left}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:baseline}sub{vertical-align:baseline}legend{color:#000}</pre>
<h3>960px Grid (12 cols, 60px width, 20px gutter)</h3>
<pre>/* Minimal Grid */
.g1{width:60px;}.g2{width:140px;}.g3{width:220px;}.g4{width:300px;}.g5{width:380px;}.g6{width:460px;}.g7{width:540px;}.g8{width:620px;}.g9{width:700px;}.g10{width:780px;}.g11{width:860px;}.g12{width:940px;}.g1,.g2,.g3,.g4,.g5,.g6,.g7,.g8,.g9,.g10,.g11,.g12{overflow:hidden;float:left;display:inline;margin:0 10px;}.r{width:960px;overflow:hidden;margin:0 auto;}.r .r{width:auto;display:inline-block;margin:0 -10px;}</pre>
<h3>CSS 100% box model</h3>
<p>Padding, borders, margins and width equals 100%:</p>
<pre><code>* {-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing: border-box;}</code></pre>
<h3>Common CSS</h3>
<pre>/* Common CSS */
html {}body {font-family:Arial,sans-serif;font-size:14px;}
a{color:#0085d5;text-decoration:none}a:hover{}
li{display:inline}
h1,h2,h3,h4,h5,h6 {}
strong,.strong {font-weight:900}em,.em {font-style:italic}
.right{text-align:right}.center {text-align:center}
.fright{float:right}.fleft{float:left}
.hide{display:none}</pre>
<h3>Sprite map</h3>
<pre>/* Sprite */
#logo,.button,
.sprite{background:transparent url('images/sprite.jpg') no-repeat;}
.ico {display:inline-block;height:16px;width:16px}
.ico.aa {background-position:-px -px}</pre>
<h3>Forms and buttons</h3>
<pre>.button{background:#eee;border:1px solid #ccc;cursor:pointer;font-weight:900;padding:5px 10px;text-decoration:none}</pre>
<h3>CSS for the coming HTML template</h3>
<pre>/* Main structure */
#wrap {}
#header {}
 #logo {}
  #logo span {display:none}
 #s {}
#topnav {}
 #nav {}
  #nav li {display:inline}
#container {}
 #container a {text-decoration:underline}
 #container li {display:list-item}
 .main {}
 .main h1 {}
 .main h2 {}
 .main p {}

 .side {}
  .side h4 {}
  .side h5 {}
  .side p {}

#footer {}
 #footer p {}
 #footer p a {}</pre>
<h3>Overlap design watermark for pixel perfect CSS</h3>
<pre>    &lt;style&gt;
        #watermark {position:fixed;top:0;left:0;width:100%;background:url(images/watermark.jpg) top center;height:5px;opacity:0.2}
        #watermark:hover {height:1000px;opacity:0.5}
    &lt;/style&gt;
    &lt;div id="watermark"&gt;&lt;/div&gt;</pre>
<h2>2. HTML Zen Coding shortcuts</h2>
<h4>Typical HTML website structure</h4>
<p>With the power of Zen Coding, I can code a full HTML website in one line of code, then press the shortcut (Ctrl+, in Dreamweaver) and voila, there you have all the HTML ready:</p>
<pre>html:xt&gt;(div#wrap&gt;(div#header.r&gt;(div.g6&gt;p#logo&gt;span)+(div.g6&gt;form#search&gt;input[type=text]#s+input[type=submit].hide))+(div#topnav.r&gt;div.g12&gt;ul.nav&gt;li*5&gt;a)+(div#container.r&gt;(div.main.g8&gt;div.post&gt;h1+p+img[src=http://dummyimage.com/150x150])+(div.side.g4&gt;h4+p&gt;ul&gt;li*5&gt;a))+(div#footer.r&gt;(div.g6&gt;p&gt;a*1)+(div.g6&gt;p&gt;a*4)))</pre>
<p>Here&#8217;s the fragmented HTML:</p>
<pre>html:xt
div#wrap
div#header.r&gt;div.g6*2
div#header.r&gt;(div.g6&gt;p#logo&gt;span)+(div.g6&gt;form#search&gt;input[type=text]#s+input[type=submit].hide)
div#topnav.r&gt;div.g12&gt;ul.nav&gt;li*5&gt;a
div#container.r&gt;(div.main.g8&gt;div.post&gt;h1+p+img[src=http://dummyimage.com/150x150])+(div.side.g4&gt;h4+p&gt;ul&gt;li*5&gt;a)
div#footer.r&gt;(div.g6&gt;p&gt;a*1)+(div.g6&gt;p&gt;a*4)</pre>
<h4>Forms and tables</h4>
<pre>form&gt;label+input:text+input:submit
select#items&gt;option[value=item-$]*3
table&gt;(tr&gt;th*2)+(tr&gt;td*2)</pre>
<h4>Listings</h4>
<pre>div.list-vert&gt;(img[src=http://dummyimage.com/100x100]+h3+p.brand+span.rating-5+p.price+(p&gt;a.button-m))</pre>
<h2>3. WordPress theme</h2>
<ol>
<li>Download the <a href="http://wpcandy.com/made/the-wordpress-starter-theme-project">Starter Theme</a></li>
<li>Add <a href="http://timthumb.googlecode.com/svn/trunk/timthumb.php">TimThumb</a></li>
<li>Then grab snippets from <a href="http://wp-snippets.com/">WP Snippets</a></li>
<li>Start coding and customizing</li>
</ol>
<h2>4. WordPress customization</h2>
<h3>In the functions.php</h3>
<pre>date_default_timezone_set('Europe/Madrid');
date_default_timezone_set('Europe/London');</pre>
<h4>TimThumb shortcut</h4>
<pre>function timthumb($src, $w, $h, $q=90, $zc=1) {
    return get_bloginfo('template_url').'/thumb.php?src='.$src.'&amp;amp;w='.$w.'&amp;amp;h='.$h.'&amp;amp;q='.$q.'&amp;amp;zc='.$zc;
}</pre>
<h4>Custom field shortcut</h4>
<pre>function customfield($name, $id="") {
    $value = get_post_custom_values($name, $id);
    return $value[0];
}</pre>
<h4>Extract images of a post</h4>
<pre>function catch_that_image() {
    global $post, $posts;
    $first_img = '';
    ob_start();
    ob_end_clean();
    $output = preg_match_all('/&lt;img.+src=[\'"]([^\'"]+)[\'"].*&gt;/i', $post-&gt;post_content, $matches);
    $first_img = $matches [1] [0];

    if(empty($first_img)){ $first_img = "/images/default.jpg"; }
    return $first_img;
}</pre>
<h4>Nice excerpts</h4>
<pre>/* This function will trim text without
cutting it in the middle of the word and
adding … if longer
*/
function trimtext($text, $length) {
    $words = explode(" ", strip_tags($text));
    $newtext = "";
    $addhellip = "";
    foreach ($words as $word) {
        if (strlen($newtext." ".$word) &lt; $length) {
            $newtext .= " ".$word;
        }else{
            $addhellip = 1;
            break;
        }
    }
    if ($addhellip) {$newtext .= "…";}
    return $newtext;
}</pre>
<h4>Get exact current page URL</h4>
<pre>function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}</pre>
<h4>Optimize WYSIWYG editor for SEO</h4>
<pre>if (isset($wp_version)) {
    add_filter("mce_buttons", "extended_editor_mce_buttons", 0);
    add_filter("mce_buttons_2", "extended_editor_mce_buttons_2", 0);
    add_filter('tiny_mce_before_init', 'extended_editor_change_mce_buttons', 0);
}

function extended_editor_mce_buttons($buttons) {
    return array(
        "formatselect", "separator",
        "bold", "italic", "separator",
        "bullist", "numlist", "blockquote", "separator",
        "link", "unlink", "separator",
        "charmap", "separator",
        "pasteword", "separator",
        "fullscreen", "separator",
    );
}

function extended_editor_mce_buttons_2($buttons) {
// the second toolbar line
return array();
}

function extended_editor_change_mce_buttons( $initArray ) {
    $initArray['theme_advanced_blockformats'] = 'p,h2,h3,h4,h5,h6,pre';
    return $initArray;
}</pre>
<h4>In the wp-config.php</h4>
<p>Disable/limit revisions</p>
<pre># Maximum 5 revisions
define('WP_POST_REVISIONS', 5);
# Disable revisions
define('WP_POST_REVISIONS', false);</pre>
<h2> 5. WordPress must-have plugins</h2>
<ul>
<li><a href="http://xaviesteve.com/2498/admin-helper-wordpress-plugin-essential-tool-for-theme-developers/">Admin Helper</a></li>
<li><a href="http://wordpress.org/extend/plugins/all-in-one-seo-pack/">All-in-one SEO</a></li>
<li><a href="http://wordpress.org/extend/plugins/google-sitemap-generator/">Google XML Sitemap</a></li>
<li><a href="http://www.dagondesign.com/articles/sitemap-generator-plugin-for-wordpress/">HTML Sitemap</a></li>
</ul>
<h3>Related posts</h3>
<ul>
<li><a title="WordPress code snippets, tricks and cheat sheet" href="http://xaviesteve.com/936/wordpress-code-snippets-tricks-and-cheat-sheet/">WordPress code snippets, tricks and cheat sheet</a></li>
<li><a title="Ultimate WordPress Performance Tip List to speed up and save up to 80% of space" href="http://xaviesteve.com/2433/clean-your-wordpress-website-to-speed-up-and-save-up-to-80-percent-of-space/">WordPress Performance</a></li>
</ul>
<div></div>
<p><small>Photo by <a href="http://www.flickr.com/photos/coffeegeek/" rel="nofollow">CoffeGeek</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://xaviesteve.com/2556/quick-website-prototyping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 essential WordPress SEO tips for content writers (one page PDF download)</title>
		<link>http://xaviesteve.com/2483/10-essential-wordpress-seo-tips-for-content-writers-one-page-pdf-download/</link>
		<comments>http://xaviesteve.com/2483/10-essential-wordpress-seo-tips-for-content-writers-one-page-pdf-download/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 07:22:16 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[content writing]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[resource]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://xaviesteve.com/?p=2483</guid>
		<description><![CDATA[About a year ago I created a one-page document for content writers in my team to write better online articles. I am now releasing it so you can print it and have it close to you while writing. These are the most basic and important SEO tips you need to know if you want your [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://xaviesteve.com/wp-content/uploads/2011/10/seo-content-writing-wordpress.jpg"><img class="alignnone size-full wp-image-2545" title="SEO content writing wordpress" src="http://xaviesteve.com/wp-content/uploads/2011/10/seo-content-writing-wordpress.jpg" alt="" width="600" height="272" /></a></p>
<p>About a year ago I created a one-page document for content writers in my team to write better online articles. I am now releasing it so you can print it and have it close to you while writing. These are the most basic and important SEO tips you need to know if you want your posts to succeed. You will find a link to download the one-page PDF at the bottom of the article.</p>
<h3><strong>1. The most important tip is to create quality content</strong></h3>
<p>Posts that are <em>bookmarked</em>, <em>shared</em>, <em>linked</em>, <em>commented</em> or <em>thanked</em>. That should be the purpose of every post and should either be:</p>
<ol>
<li><strong>Useful</strong> (people reference to them)</li>
<li><strong>Interesting</strong> (people bookmark them)</li>
<li><strong>Funny</strong> or entertaining (people share them)</li>
</ol>
<p>Here&#8217;s a good article extending this concept on <a title="Effective SEO – Purposes and Actions in Content Writing" href="http://xaviesteve.com/1912/effective-seo-purposes-and-actions-in-content-writing/">writing with a purpose</a>.</p>
<h3><strong>2. User goes always first</strong></h3>
<p>Keep the post readable and attractive to humans. Google is secondary. Ensuring you write for your users will have <a title="Future-proof SEO – Avoiding Google penalization" href="http://xaviesteve.com/1985/future-proof-seo-avoiding-google-penalization/">long-term SEO benefits</a>.</p>
<h3><strong>3. Use Headings to split the content</strong></h3>
<p>Heading 1 is always the page title and it is the most important title. Headings to use in the content <strong>must start from Heading 2</strong> to a max depth of H6. Use headings instead of bolding or formatting the text yourself.</p>
<h3><strong>4. Use eye-catching titles but keep them short</strong></h3>
<p>Don&#8217;t be just informative, get the user&#8217;s attention.</p>
<ol>
<li><span style="text-decoration: line-through;">Windows tricks</span> -&gt; Top 10 coolest tricks for Windows!</li>
<li><span style="text-decoration: line-through;">London party places</span> -&gt; Best secret places to party in London</li>
</ol>
<h3><strong>5. First paragraphs are the most important ones</strong></h3>
<p>Search Engines give more importance to the first part of the posts. In fact, really large posts are usually not indexed completely.</p>
<h3><strong>6. Be descriptive by adding keywords whenever possible</strong></h3>
<p>All headings should have <strong>keywords</strong> in them:</p>
<ol>
<li><span style="text-decoration: line-through;">What I like</span> -&gt; What I like about the HP Pavilion laptop</li>
<li><span style="text-decoration: line-through;">My trip</span> -&gt; My awesome trip to Barcelona this summer</li>
</ol>
<h3><strong>7. Use synonyms</strong></h3>
<p>Don’t repeat keywords you are not targeting for, <strong>use a lot of synonyms</strong> instead.</p>
<ol>
<li>What I like about Acer -&gt; Review about Acer computers / My opinion on Acer laptops</li>
</ol>
<p>This way, users searching for &#8220;acer review&#8221;, &#8220;acer opinion&#8221; or &#8220;acer laptop&#8221; will find our page.</p>
<h3><strong>8. Rich formatting increases SEO</strong></h3>
<p>Eases Search Engines to identify the content.</p>
<ul>
<li>Using <strong>lists</strong> (and differentiating between ordered and unordered lists),</li>
<li><strong>bold</strong> and <strong>italic</strong> words or sentences,</li>
<li><strong>blockquote</strong> paragraphs when quoting or pasting literal text</li>
</ul>
<h3><strong>9. Add both inbound and outbound links</strong></h3>
<p>Links to authority webs like Flickr, Wikipedia or YouTube can be frequent (you don&#8217;t lose any PageRank juice). But don’t link too much to other websites (one or two per paragraph). Always <strong>describe the links</strong>:</p>
<ol>
<li><span style="text-decoration: line-through;">Download the Flash player by <span style="text-decoration: underline;">clicking here</span>.</span> -&gt; <span style="text-decoration: underline;">Download the Flash player</span>.</li>
</ol>
<h3><strong>10. Format posts inside WordPress</strong></h3>
<p>Text editors like Microsoft Word may add irrelevant or invalid code into posts. If the text is in Word, paste it in Notepad so it looses all formatting, then copy and paste into WordPress and <strong>format it there</strong> using Headings, lists, bold, italic, etc.</p>
<h2>Download the 10 SEO tips for WordPress PDF file</h2>
<p><a class="button blue" href="http://xaviesteve.com/wp-content/uploads/2011/09/Wordpress-SEO-writer-tips.pdf">10 SEO tips for WordPress PDF file</a><br />
If you have any doubts feel free to ask them in the comments. Also, share this article with your team, friends and colleagues for increased results and better blogging.</p>
]]></content:encoded>
			<wfw:commentRss>http://xaviesteve.com/2483/10-essential-wordpress-seo-tips-for-content-writers-one-page-pdf-download/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress &#8211; Get depth of pages and subpages</title>
		<link>http://xaviesteve.com/2512/wordpress-get-depth-of-pages-and-subpages/</link>
		<comments>http://xaviesteve.com/2512/wordpress-get-depth-of-pages-and-subpages/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 13:26:46 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[trick]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://xaviesteve.com/?p=2512</guid>
		<description><![CDATA[This is how you can get how deep a page is compared to the root/home page in WordPress, works for both the current page or any page by providing its ID. Copy this script and paste it in your functions.php file: function get_depth($postid) { $depth = ($postid==get_option('page_on_front')) ? -1 : 0; while ($postid &#62; 0) [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://xaviesteve.com/wp-content/uploads/2011/09/wordpress-performance-speed-tips1.jpg"><img class="alignnone size-full wp-image-2513" title="" src="http://xaviesteve.com/wp-content/uploads/2011/09/wordpress-performance-speed-tips1.jpg" alt="" width="600" height="333" /></a></p>
<p>This is how you can get how deep a page is compared to the root/home page in WordPress, works for both the current page or any page by providing its ID. Copy this script and paste it in your functions.php file:</p>
<pre>function get_depth($postid) {
  $depth = ($postid==get_option('page_on_front')) ? -1 : 0;
  while ($postid &gt; 0) {
    $postid = get_post_ancestors($postid);
    $postid = $postid[0];
    $depth++;
  }
  return $depth;
}</pre>
<p>Now paste this anywhere in a loop:</p>
<pre>echo get_depth($post-&gt;ID);</pre>
<p>Other solutions I&#8217;ve found on the Internet where 50 lines long or even 100 and they where full of loops and slow, that&#8217;s why I decided to code this one.</p>
<p>The home page will return 0, direct childs will return 1, childs of childs will return 2, etc.</p>
<h3>One line Alternative</h3>
<p>You can also use this one:</p>
<pre>echo count($post-&gt;ancestors);</pre>
<p>Although it will not differentiate between the home page and level 1 pages (will output 0).</p>
<p>That&#8217;s it, easy as pie! If you maintain WordPress sites or are a theme developer see this post on advanced tips to <a title="Ultimate WordPress Performance Tip List to speed up and save up to 80% of space" href="http://xaviesteve.com/2433/clean-your-wordpress-website-to-speed-up-and-save-up-to-80-percent-of-space/">improve performance and gain space in WordPress</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://xaviesteve.com/2512/wordpress-get-depth-of-pages-and-subpages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Admin Helper &#8211; WordPress Plugin (essential tool for theme developers)</title>
		<link>http://xaviesteve.com/2498/admin-helper-wordpress-plugin-essential-tool-for-theme-developers/</link>
		<comments>http://xaviesteve.com/2498/admin-helper-wordpress-plugin-essential-tool-for-theme-developers/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 20:09:06 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://xaviesteve.com/?p=2498</guid>
		<description><![CDATA[Admin Helper is a tiny WordPress Plugin that will provide you useful information such as the ID of the current page, the type of page you are viewing (post, page, category, tag, tax, author, archive, 404, search&#8230;), the template used by the page, the order of the page and links to edit the page, the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Admin Helper</strong> is a tiny WordPress Plugin that will provide you useful information such as the ID of the current page, the type of page you are viewing (post, page, category, tag, tax, author, archive, 404, search&#8230;), the template used by the page, the order of the page and links to edit the page, the Administration Panel and logout.</p>
<p><img class="size-full wp-image-2499 aligncenter" title="Admin Helper WordPress Plugin" src="http://xaviesteve.com/wp-content/uploads/2011/09/admin-helper-wordpress-plugin.jpg" alt="" width="213" height="156" /></p>
<p>The plugin is extremely lightweight and is an <strong>essential tool for WordPress theme developers</strong>.</p>
<p>Admin Helper is hidden and does not show unless you are logged in. Once logged in it appears unobtrusively like this:</p>
<p><img class="size-full wp-image-2500 aligncenter" title="Admin Helper Hidden" src="http://xaviesteve.com/wp-content/uploads/2011/09/admin-helper-wordpress-plugin-hidden.jpg" alt="" width="213" height="156" /></p>
<p>So it is not as annoying as the default Admin Bar that comes with WordPress yet it provides everything you need while developing the WordPress theme in a mouse move or click.</p>
<p>Login square: While you are not connected, a 5&#215;5 invisible square at the bottom right of the page will link you to the Login page.</p>
<p>You can download the plugin by following the link below:</p>
<p><a class="button blue big" href="/wp-content/uploads/2011/09/admin-helper.php.txt">Admin helper WordPress Plugin v1.2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://xaviesteve.com/2498/admin-helper-wordpress-plugin-essential-tool-for-theme-developers/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Ultimate WordPress Performance Tip List to speed up and save up to 80% of space</title>
		<link>http://xaviesteve.com/2433/clean-your-wordpress-website-to-speed-up-and-save-up-to-80-percent-of-space/</link>
		<comments>http://xaviesteve.com/2433/clean-your-wordpress-website-to-speed-up-and-save-up-to-80-percent-of-space/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 14:54:26 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[optimize]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://xaviesteve.com/?p=2433</guid>
		<description><![CDATA[This is a list of actions and tips to take in order to make your WordPress website faster and improve its performance. You should follow these steps at least once every 3-6 months depending on your website&#8217;s activity in order to keep it clean and to increase its performance to a top level. If you [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2478" title="Wordpress Ultimate Performance Tips" src="http://xaviesteve.com/wp-content/uploads/2011/09/wordpress-performance-speed-tips.jpg" alt="Wordpress Ultimate Performance Tips" width="600" height="333" /></p>
<p>This is a list of actions and tips to take in order to make your WordPress website faster and improve its performance. You should follow these steps at least once every 3-6 months depending on your website&#8217;s activity in order to keep it clean and to increase its performance to a top level. If you have been using WordPress for a while and have never cleaned it you may be surprised at how much database space you can save up, the last cleaning I did to a client saved 82% of space going from 132MB to 23MB.</p>
<p>Before running any queries in the database take backups of everything and make sure no one is editing any post or page while cleaning WordPress.</p>
<h2>The database</h2>
<h3>1. Delete post revisions</h3>
<p>Create a backup of the revisions first by selecting and exporting them:</p>
<pre>SELECT * FROM wp_posts WHERE post_type = 'revision'</pre>
<p>Then delete them and be amazed at the big space savings:</p>
<pre>DELETE FROM wp_posts WHERE post_type = 'revision'</pre>
<h3>2. Limit post revision</h3>
<p>By default, WordPress saves every revision of a post. This can make your <code>wp_posts</code> table 2 to 10 times bigger than necessary. In your <code>wp-config.php</code> file, add this:</p>
<pre>define('WP_POST_REVISIONS', no_of_revisions);</pre>
<p>Leaving number of revisions to 10 is more than enough, if your blog is used by 1 or 2 people then 5 may be even better.</p>
<h4>3. Disabling post revision</h4>
<p>You can disable post revision completely (although I would personally leave it just in case). To do that:</p>
<pre>define('WP_POST_REVISIONS', false);</pre>
<h3>4. Deleting spam comments</h3>
<p>If you don’t use Akismet or any other effective spam control service, spam messages can bloat your database waiting to be approved or deleted. You can either go to the WordPress <em>Administration Panel</em> &gt; <em>Comments</em> and delete them or just head to MySQL and execute this:</p>
<pre>DELETE FROM `wp_comments` WHERE `comment_approved` NOT LIKE '1'</pre>
<p>This query will delete both <strong>spam, pending and trashed</strong> comments.</p>
<h4>5. Disable comments in all your WordPress blog posts</h4>
<p>Some WordPress sites get loads of real comments every day but some don’t. If your website just receives spammy comments and you guess one in a million will be real, I may suggest you to consider disabling them, not only will this save you time and loads of database space but will also increase the performance and loading speed of your pages. You can install Disqus which allows people to post comments through several ways (Twitter, Facebook, manually, etc.) and has very effective spam protection. If you don&#8217;t get many comments and performance/SEO is a must then add a link to a Contact Us page next to the post and encourage people to contact you that way.<br />
To disable comments go to <em>Settings</em> &gt; <em>Discussion</em> and disable these two checkboxes:</p>
<ul>
<li>Allow link notifications from other blogs (pingbacks and trackbacks.)</li>
<li>Allow people to post comments on new articles</li>
</ul>
<p>This will disable comments only in the new posts you create from now on. To disable comments (and pings) in your existing blog posts execute this query in your MySQL:</p>
<pre>UPDATE `wp_posts` SET `comment_status` = 'closed', `ping_status` = 'closed';</pre>
<h3>6. Delete plugin log tables</h3>
<p>Some plugins store log files in your database but these can sometimes get way too big if the plugin developer hasn’t set a limit. Check your database tables and look for big tables or tables containing <code>log</code> in their name.</p>
<h3>7. Delete old plugin tables</h3>
<p>Some WordPress plugins create tables in your database and when you delete them, the tables are still there to keep your configuration if you ever install the plugin again. If you do not intend to install them anymore, have a quick look at your database tables and see if you find any remains of those plugins.</p>
<h3>8. Delete old plugin option parameters</h3>
<p>Some WordPress plugins also store information in the <code>wp_options</code> table.</p>
<h3>9. Optimize, analyze, check and repair your tables</h3>
<p>After deleting so many records, it is good to optimize your tables again to remove any over-heading data.</p>
<h3>10. Check your WordPress table&#8217;s Primary and Index Keys</h3>
<p><a href="http://xaviesteve.com/wp-content/uploads/2011/09/advanced-tips-optimize-wordpress-database.jpg"><img class="alignnone size-full wp-image-2509" title="" src="http://xaviesteve.com/wp-content/uploads/2011/09/advanced-tips-optimize-wordpress-database.jpg" alt="advanced tips to optimize wordpress database" width="334" height="273" /></a></p>
<p>It’s not just about size what makes a database run slower but the way it is indexed. Once you have cleaned your database, it is time to check that MySQL is indexing everything properly. phpMyAdmin is a very powerful tool and may also warn you about it or suggest better ways. I suggest you read more about MySQL and how it works to understand how queries are made, how to index properly and how a database works on the background.</p>
<h2>The server</h2>
<h3>11. Remove old plugins completely</h3>
<p>Connect with your FTP and remove any old plugins you are not using anymore. Don&#8217;t bother to remove Hello Dolly as it will get installed again in the next update.</p>
<h3>12. Search for the upgrade folder</h3>
<p>Sometimes (usually on failed WordPress automatic upgrades) an <code>upgrade</code> folder is created which contains some temporary files that you can remove.</p>
<h3>13. Search for old backups</h3>
<p>Delete old backups from the web server and store them locally, also search inside your plugins in case any of them stores backups there.</p>
<h3>14. Search for cache files</h3>
<p>If you use TimThumb or any other file caching system it is a good idea to, once in a while, clean the complete cache folder to remove items not used in a long time.</p>
<h2>WordPress settings</h2>
<p>You&#8217;ve now cleaned the database and the server files and probably made the server much quicker. You can now tweak your WordPress installation to make it work even faster.</p>
<h3>15. Upgrade to the latest version</h3>
<p>Seems quite obvious but it really makes a difference and protects you from any bugs.</p>
<h3>16. Empty the posts/pages trash</h3>
<p>The trash is emptied every 30 days by default. You can change that time by adding this function to your <code>functions.php</code> file:</p>
<pre>//empty WordPress trash once a week
define('EMPTY_TRASH_DAYS', 7);</pre>
<p>Or change the number to <code>0</code> to disable automatically emptying the trash at all.</p>
<h3>17. WordPress permalinks</h3>
<p>One of the biggest neglected performance hits by advanced users is the way you set up your permalinks. There has been <a href="http://www.google.com/?q=wordpress+permalink+performance">much discussion</a> and it has been <a href="http://musique.jeuxactu.com/news-mort-subite-de-dj-mehdi-a-34-ans-8869.htm">demonstrated</a> that you should not just use <code>/%postname%/</code> as your Permalink structure. I personally use <code>/%post_id%/%postname%/</code> as it&#8217;s the fastest query (the Post ID is a primary key in MySQL).</p>
<h3>18. Remove non-changing dynamic code</h3>
<p>PHP functions such as <code>&lt;?php bloginfo('title'); ?&gt;</code> or <code>&lt;?php if ( function_exists('my_plugin') ) ?&gt;</code> nearly always output the same value so it doesn&#8217;t make sense to request it all the time increasing server load. Replacing those with its static content will decrease avoidable queries. To see how many queries a page load does you can use this code: <code>&lt;?php echo get_num_queries();?&gt;</code> .</p>
<h3>19. Enable the default WordPress Object Cache</h3>
<p>If you are using a cache plugin such as WP Super Cache, W3 Total Cache or WP-Cache you should ignore this step.</p>
<p>Since WordPress 2.0 there is a feature called <em>Object Cache</em> which is not enabled by default. To enable it follow these steps:</p>
<ul>
<li>Open <code>wp-config.php</code> in your WordPress root folder</li>
<li>Add the following code:
<pre>define('ENABLE_CACHE', TRUE);</pre>
</li>
<li>Create a new folder called <code>cache</code> to store all the cached files in <code>wp-content</code></li>
<li>Change the <code>cache</code> folder permission to <code>755</code> or <code>777</code></li>
</ul>
<p>You can set an expiration time to keep it clean, to do this add this line too (time is in seconds):</p>
<pre>define('CACHE_EXPIRATION_TIME', 3600); // 1 hour</pre>
<h3>20. Move your WordPress installation to a subdirectory</h3>
<p>It will help keep the web server root folder cleaner. To do this you will need to do some tweaks in your website&#8217;s administration panel or in Apache so that the destination of your domain points to the <code>/wordpress/</code> folder.</p>
<h3>21. Fix PHP notices and warnings</h3>
<p>The plugins and theme you are using work fine, if not you would disable them. But occasionally some of them are not coded a 100% correctly. One of the most common issues is not defining variables in PHP, this is not just a bad coding practice but it also makes the PHP engine go a bit crazy and take extra time to process the code. It is very easy to fix and any beginner programmer should be able to manage this. Once you are done, notify the plugin/theme authors of these so they fix the warnings and notices on the next release. Enable <code>WP_DEBUG</code> in your <code>wp-config.php</code> file and read this article on <a title="PHP error suppression performance" href="http://seanmonstar.com/post/909029460/php-error-suppression-performance">PHP error suppression performance</a>.</p>
<h2>Further tips</h2>
<h3>22. Change your hosting provider</h3>
<p>One of the main reasons why websites load slowly and sluggish is because of the hosting provider. Some hostings such as GoDaddy have really bad reputation and you should move to somewhere else like HostGator, you may spend £2-10 more per month but both your users and Google will compensate you.</p>
<h2>Final notes</h2>
<p>Here we&#8217;ve just covered optimizing a WordPress installation although you can keep optimizing the PHP code, MySQL queries, use less HTML, optimize the CSS selectors and use a sprite map, tailor Apache to your needs, enable Gzip compression to your files or use a Content Delivery Network amongst many others.</p>
]]></content:encoded>
			<wfw:commentRss>http://xaviesteve.com/2433/clean-your-wordpress-website-to-speed-up-and-save-up-to-80-percent-of-space/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>UserCake 1.4 en Català (arxiu d&#8217;idioma)</title>
		<link>http://xaviesteve.com/2438/usercake-1-4-en-catala-arxiu-didioma/</link>
		<comments>http://xaviesteve.com/2438/usercake-1-4-en-catala-arxiu-didioma/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 06:46:14 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
				<category><![CDATA[Català]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://xaviesteve.com/?p=2438</guid>
		<description><![CDATA[UserCake és un sistema senzill de gestió d&#8217;usuaris desenvolupat en PHP. Hi ha molts sistemes d&#8217;usuari a Internet i una gran quantitat de tutorials també. Lamentablement molts són complicats, mal programats o insegurs. L&#8217;objectiu d&#8217;UserCake és proporcionar als programadors amb una base per a construir aplicacions per a l&#8217;usuari sense tots els problemes. UserCake està [...]]]></description>
			<content:encoded><![CDATA[<p><img class="fleft size-full wp-image-2442" title="usercake-logo" src="http://xaviesteve.com/wp-content/uploads/2011/08/usercake-logo.jpg" alt="" width="330" height="215" /></p>
<p>UserCake és un sistema senzill de gestió d&#8217;usuaris desenvolupat en PHP. Hi ha molts sistemes d&#8217;usuari a Internet i una gran quantitat de tutorials també. Lamentablement molts són complicats, mal programats o insegurs. L&#8217;objectiu d&#8217;UserCake és proporcionar als programadors amb una base per a construir aplicacions per a l&#8217;usuari sense tots els problemes. UserCake està clarament escrit i ben documentat en el codi base. Desenvolupar amb UserCake és senzill i ràpid.</p>
<p>Pots descarregar el <strong>pack d&#8217;idioma traduït al català</strong> des d&#8217;aquí:</p>
<p><a class="button blue big" title="UserCake 1.4 (ca.php)" href="http://xaviesteve.com/wp-content/uploads/2011/08/ca.php.txt" target="_blank">ca.php</a> (UserCake 1.4)</p>
<p>Per a instalar-lo renombra l&#8217;arxiu de dalt a <code>ca.php</code> i guarda&#8217;l a <code>usercake/models/lang/</code>. Modifica la variable <code>$langauge</code> a <code>ca</code> de l&#8217;arxiu <code>usercake/models/settings.php</code>.</p>
<p>Web oficial: <a href="http://usercake.com/" rel="nofollow">UserCake</a></p>
]]></content:encoded>
			<wfw:commentRss>http://xaviesteve.com/2438/usercake-1-4-en-catala-arxiu-didioma/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

