<?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>Alberto Bustamante &#187; WordPress</title>
	<atom:link href="http://www.albertobustamante.com/blog/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.albertobustamante.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 03 Feb 2012 16:09:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Random Sentences, your first WordPress plugin</title>
		<link>http://www.albertobustamante.com/blog/2011/01/random-sentences-your-first-wordpress-plugin/</link>
		<comments>http://www.albertobustamante.com/blog/2011/01/random-sentences-your-first-wordpress-plugin/#comments</comments>
		<pubDate>Sat, 15 Jan 2011 22:29:00 +0000</pubDate>
		<dc:creator>Alberto</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.albertobustamante.com/blog/?p=211</guid>
		<description><![CDATA[I have been reading about WordPress plugin development, and I have written a dummy example. This plugin allows you to include random sentences in your blog. This is used in a lot of sites, for example, to change a phrase that appears under the main title. I felt very creative, so I called this plugin [...]]]></description>
			<content:encoded><![CDATA[<p>I have been reading about WordPress plugin development, and I have written a dummy example. This plugin allows you to include random sentences in your blog. This is used in a lot of sites, for example, to change a phrase that appears under the main title. I felt very creative, so I called this plugin &#8220;Random Sentences&#8221; (hurray for me!).</p>
<p>First, we have to create a <code>random-sentences.php</code> file in our <code>wp-content/plugins</code> folder, and write the plugin info in it.</p>
<blockquote>
<pre>&lt;?php
/*
Plugin Name: Random Sentences
Version: 0.1
Plugin URI: http://www.albertobustamante.com
Description: Basic plugin that shows a random sentence
Author: Alberto Bustamante
Author URI: http://www.albertobustamante.com
*/

?&gt;</pre>
</blockquote>
<p>If you check your plugins in your WordPress installation, you will see our great brand new plugin with the information you wrote in the file:<br />
<img src="http://www.albertobustamante.com/blog/wp-content/uploads/2011/01/plugin.png" alt="" title="plugin" width="500" height="76" class="aligncenter size-medium wp-image-241" /></p>
<p>But right now, our plugin is kind of boring, isn&#8217;t? Lets write the function that will choose a random sentence. I have called it <code>get_random_sentence()</code>:</p>
<blockquote>
<pre>&lt;?php
/*
Plugin Name: Random Sentences
Version: 0.1
Plugin URI: http://www.albertobustamante.com
Description: Basic plugin that shows a random sentence
Author: Alberto Bustamante
Author URI: http://www.albertobustamante.com
*/

function get_random_sentence(){

	$all_sentences = array(
		1 => array( "sentence" => "This is the sentence 1",
					"author" => "Anonymous 1" ),
		2 => array( "sentence" => "This is the sentence 2",
					"author" => "Anonymous 2" ),
		3 => array( "sentence" => "This is the sentence 3",
					"author" => "Anonymous 3" ),
	);

	$min = 1;
	$max = 3;
	$index = rand($min,$max);

	$output =
		'&lt;div id="RS_div">
			&lt;p id="RS_sentence">'
				.$all_sentences[$index]["sentence"].
			'&lt;/p>
			&lt;p id="RS_author">'
				.$all_sentences[$index]["author"].
			'&lt;/p>
		&lt;/div>';

	echo $output;
}

?></pre>
</blockquote>
<p>As you can see, its a very simple function. It uses an array to store the sentences and its authors. I will try to store the sentences in the data base in the next version.<br />
If you want to use this code, save the file, activate the plugin and include this line where you want the random sentences to appear: </p>
<blockquote><p><code>&lt;?php get_random_sentence(); /></code></p></blockquote>
<p>Finally, write your own CSS code to adapt the output to your theme (I included ids in the html tags to do it).</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.albertobustamante.com/blog/2009/12/fixing-wordpress-error-500/" rel="bookmark" class="crp_title">Fixing WordPress Error 500</a></li><li><a href="http://www.albertobustamante.com/blog/2010/11/solving-fake-checkouts-using-clearcase-and-eclipse/" rel="bookmark" class="crp_title">Solving fake checkouts using ClearCase and Eclipse</a></li><li><a href="http://www.albertobustamante.com/blog/2009/12/jscrollpane-jtable-and-horizontal-scroll/" rel="bookmark" class="crp_title">JScrollPane, JTable and horizontal scroll</a></li><li><a href="http://www.albertobustamante.com/blog/2010/05/automatic-recognition-of-sarcasm/" rel="bookmark" class="crp_title">Automatic recognition of sarcasm</a></li><li><a href="http://www.albertobustamante.com/blog/2009/05/fixing-wordpress-error-406/" rel="bookmark" class="crp_title">Fixing WordPress Error 406</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.albertobustamante.com/blog/2011/01/random-sentences-your-first-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing WordPress Error 500</title>
		<link>http://www.albertobustamante.com/blog/2009/12/fixing-wordpress-error-500/</link>
		<comments>http://www.albertobustamante.com/blog/2009/12/fixing-wordpress-error-500/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 19:07:17 +0000</pubDate>
		<dc:creator>Alberto</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[error 500]]></category>

		<guid isPermaLink="false">http://www.albertobustamante.com/blog/?p=109</guid>
		<description><![CDATA[After this, I&#8217;ve learned that its convenient to deactivate all your plugins before updating to the last version of WordPress. Im not sure when I did the last update, but it seems this blog have been offline since then. This morning I tried to read an article of the blog, and I got an &#8220;Error [...]]]></description>
			<content:encoded><![CDATA[<p>After this, I&#8217;ve learned that its convenient to deactivate all your plugins before updating to the last version of WordPress. Im not sure when I did the last update, but it seems this blog have been offline since then. </p>
<p>This morning I tried to read an article of the blog, and I got an &#8220;Error 500&#8243; message. First of all, I checked that my WordPress was working, because I could access to my dashboard. Next step: deactivate all the plugins. But it didnt work. So lets take a look into the Apache log. What I found was:</p>
<blockquote><p>SoftException in Application.cpp:252: File &#8220;/home/xxxxx/public_html/blog/index.php&#8221; is writeable by group</p></blockquote>
<p>Thats it: a permissions problem. So I used Cyberduck (but you can use any other FTP application) to fix it. Delete the &#8220;write&#8221; permissions of Group and Others:<br />
<center><img src="http://www.albertobustamante.com/blog/wp-content/uploads/2009/12/Imagen-6.png" alt="Permissions-Cyberduck" title="Permissions-Cyberduck" width="391" height="204" class="aligncenter size-full wp-image-112" /></center></p>
<p>Note: be sure to apply this to all your files and directories. In my case, as you can see in the image, I used the option &#8220;Apply changes recursively&#8221;. Your FTP application should have the option to do something like this.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.albertobustamante.com/blog/2009/05/fixing-wordpress-error-406/" rel="bookmark" class="crp_title">Fixing WordPress Error 406</a></li><li><a href="http://www.albertobustamante.com/blog/2010/11/solving-fake-checkouts-using-clearcase-and-eclipse/" rel="bookmark" class="crp_title">Solving fake checkouts using ClearCase and Eclipse</a></li><li><a href="http://www.albertobustamante.com/blog/2009/11/solving-problems-with-subversion/" rel="bookmark" class="crp_title">Solving problems with Subversion</a></li><li><a href="http://www.albertobustamante.com/blog/2011/01/random-sentences-your-first-wordpress-plugin/" rel="bookmark" class="crp_title">Random Sentences, your first WordPress plugin</a></li><li><a href="http://www.albertobustamante.com/blog/2010/05/automatic-recognition-of-sarcasm/" rel="bookmark" class="crp_title">Automatic recognition of sarcasm</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.albertobustamante.com/blog/2009/12/fixing-wordpress-error-500/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing WordPress Error 406</title>
		<link>http://www.albertobustamante.com/blog/2009/05/fixing-wordpress-error-406/</link>
		<comments>http://www.albertobustamante.com/blog/2009/05/fixing-wordpress-error-406/#comments</comments>
		<pubDate>Thu, 14 May 2009 19:30:06 +0000</pubDate>
		<dc:creator>Alberto</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.albertobustamante.com/blog/?p=29</guid>
		<description><![CDATA[Let me guess: you are trying to edit posts or pages in your WordPress blog and you got &#8220;Error 406, Not Acceptable. An appropriate representation of the requested resource /wp-admin/post.php could not be found on this server&#8221;. Ok, dont panic, lets fix it. In the root directory of your WordPress installation, you should have a [...]]]></description>
			<content:encoded><![CDATA[<p>Let me guess: you are trying to edit posts or pages in your WordPress blog and you got &#8220;Error 406, Not Acceptable. An appropriate representation of the requested resource /wp-admin/post.php could not be found on this server&#8221;. Ok, dont panic, lets fix it.</p>
<p>In the root directory of your WordPress installation, you should have a file called &#8220;.htaccess&#8221;. You have to edit this file, adding the following line:</p>
<blockquote><p>SecFilterEngine off</p></blockquote>
<p>With this single line, your blog will work perfectly.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.albertobustamante.com/blog/2009/12/fixing-wordpress-error-500/" rel="bookmark" class="crp_title">Fixing WordPress Error 500</a></li><li><a href="http://www.albertobustamante.com/blog/2009/05/how-to-edit-path-variable-on-mac/" rel="bookmark" class="crp_title">How to edit PATH variable on Mac</a></li><li><a href="http://www.albertobustamante.com/blog/2010/11/solving-fake-checkouts-using-clearcase-and-eclipse/" rel="bookmark" class="crp_title">Solving fake checkouts using ClearCase and Eclipse</a></li><li><a href="http://www.albertobustamante.com/blog/2011/01/random-sentences-your-first-wordpress-plugin/" rel="bookmark" class="crp_title">Random Sentences, your first WordPress plugin</a></li><li><a href="http://www.albertobustamante.com/blog/2009/11/compiling-erlang-on-mac/" rel="bookmark" class="crp_title">Compiling Erlang on Mac</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.albertobustamante.com/blog/2009/05/fixing-wordpress-error-406/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

