<?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>Frank Verhoeven &#187; WordPress</title>
	<atom:link href="http://www.frank-verhoeven.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.frank-verhoeven.com</link>
	<description>Webdevelopment Blog</description>
	<lastBuildDate>Sat, 08 Oct 2011 21:51:59 +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>FV Community News 2.0 &#8211; Beta 2</title>
		<link>http://www.frank-verhoeven.com/fv-community-news-2-0-beta-2/</link>
		<comments>http://www.frank-verhoeven.com/fv-community-news-2-0-beta-2/#comments</comments>
		<pubDate>Sun, 24 Apr 2011 11:57:49 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=455</guid>
		<description><![CDATA[I am very pleased to announce that the plugin has reached a new milestone! Since the last update there have been significant changes. For people who like to browse the code, as well as for the default users who just like to use the plugin. Code Cleanup First of all, there has been a huge [...]]]></description>
			<content:encoded><![CDATA[<p>I am very pleased to announce that the plugin has reached a new milestone!</p>
<p>Since the last update there have been significant changes. For people who like to browse the code, as well as for the default users who just like to use the plugin.<span id="more-455"></span></p>
<h3>Code Cleanup</h3>
<p>First of all, there has been a huge cleanup in the source code. Comments have been added to all the functions to help people understand the code, and help solving problems. The code itself also has had big improvements; speed and customization are probably the biggest points here. With hooks added to almost every part of the plugin, you can customize it any way you want.</p>
<p>Also the addition of template functions, very similar to the functions you are used to using in your WordPress themes, allow you to change the look of your community news more then ever before. More information on theme customization will follow within a couple of days.</p>
<h3>Admin AJAXization</h3>
<p>Another thing I really, really wanted to do is speed up the moderation of your Community News. While thinking about it, I came to the conclusion that the only way to do that is by using AJAX. So from now on, Community News moderation will be faster then ever before. Both the dashboard and the moderation page are using JavaScript/AJAX for single post moderation. I think you will really enjoy this change.</p>
<h3>And More</h3>
<p>Besides these two points there have been a lot more changes of course. In fact, to many things have changed to list them here. In the next week(s) or so I will get documentation up on the various things that require it.</p>
<p>If you can&#8217;t wait that long, you don&#8217;t have to! You can download the beta right now from the WordPress repository. Just go the <a title="FV Community News download page" href="http://wordpress.org/extend/plugins/fv-community-news/download/" target="_blank">the download page</a>, and select the development version.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/fv-community-news-2-0-beta-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create an RSS Feed with WordPress</title>
		<link>http://www.frank-verhoeven.com/create-an-rss-feed-with-wordpress/</link>
		<comments>http://www.frank-verhoeven.com/create-an-rss-feed-with-wordpress/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 16:41:00 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=238</guid>
		<description><![CDATA[When you are busy creating a wonderful plugin for your WordPress blog, it might be possible that you need to create a RSS feed. For example, when creating a guestbook people could ask for a RSS feed to view the recent added posts and stay updated, or take a look at my own Community News [...]]]></description>
			<content:encoded><![CDATA[<p>When you are busy creating a wonderful plugin for your WordPress blog, it might be possible that you need to create a RSS feed. For example, when creating a guestbook people could ask for a RSS feed to view the recent added posts and stay updated, or take a look at my own <a href="http://www.frank-verhoeven.com/wordpress-plugin-fv-community-news/">Community News Plugin</a>, isn&#8217;t it great if it had a build-in RSS feed as well?</p>
<p>Well don&#8217;t worry I am busy to create that and it is almost finished. In the mean while, I wanted to share some stuff I learned while creating this RSS feed.</p>
<h3>The Beginning</h3>
<p>The first thing we need is a function that actually creates the RSS feed. This function doesn&#8217;t need any parameters and it also shouldn&#8217;t return anything.<br />
<span id="more-238"></span></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
</pre>
<pre><span class="php"><span class="php-script-tag">&lt;?php</span>
<span class="php-function">function</span> myGreatPluginRSSFeed<span class="php-brackets">(</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>
    <span class="php-comment">// Function content goes here.
</span>
<span class="php-brackets">}</span>
<span class="php-script-tag">?&gt;<span class="html"></span></span></span></pre>
</div>
<p>This function must create the whole feed form the beginning to the end. So, you also have to include the xml/rss header. I ripped something from the default WordPress feed that should work for any blog.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
</pre>
<pre><span class="php"><span class="php-operator">&lt;</span>rss version<span class="php-operator">=</span><span class="php-string">&quot;2.0&quot;</span>
	xmlns<span class="php-operator">:</span>content<span class="php-operator">=</span><span class="php-string">&quot;http://purl.org/rss/1.0/modules/content/&quot;</span>
	xmlns<span class="php-operator">:</span>dc<span class="php-operator">=</span><span class="php-string">&quot;http://purl.org/dc/elements/1.1/&quot;</span>
	xmlns<span class="php-operator">:</span>atom<span class="php-operator">=</span><span class="php-string">&quot;http://www.w3.org/2005/Atom&quot;</span>
	xmlns<span class="php-operator">:</span>sy<span class="php-operator">=</span><span class="php-string">&quot;http://purl.org/rss/1.0/modules/syndication/&quot;</span><span class="php-operator">&gt;</span>

	<span class="php-operator">&lt;</span>channel<span class="php-operator">&gt;</span>
		<span class="php-operator">&lt;</span>title<span class="php-operator">&gt;</span><span class="php-script-tag">&lt;?php</span> bloginfo_rss<span class="php-brackets">(</span><span class="php-string">'name'</span><span class="php-brackets">)</span>; wp_title_rss<span class="php-brackets">(</span><span class="php-brackets">)</span>; <span class="php-script-tag">?&gt;<span class="html"><span class="html-other-element">&lt;/title&gt;</span>
		<span class="html-other-element">&lt;link&gt;</span></span>&lt;?php</span> bloginfo_rss<span class="php-brackets">(</span><span class="php-string">'url'</span><span class="php-brackets">)</span> <span class="php-script-tag">?&gt;<span class="html"><span class="html-other-element">&lt;/link&gt;</span>
		<span class="html-anchor-element">&lt;atom:link href=<span class="html-attribute">&quot;</span></span></span>&lt;?php</span> self_link<span class="php-brackets">(</span><span class="php-brackets">)</span>; <span class="php-script-tag">?&gt;<span class="html">&quot; rel=&quot;self&quot; type=&quot;application/rss+xml&quot; /&gt;
		<span class="html-other-element">&lt;description&gt;</span></span>&lt;?php</span> bloginfo_rss<span class="php-brackets">(</span><span class="php-string">&quot;description&quot;</span><span class="php-brackets">)</span> <span class="php-script-tag">?&gt;<span class="html"><span class="html-other-element">&lt;/description&gt;</span>
		<span class="html-other-element">&lt;language&gt;</span></span>&lt;?php</span> <span class="php-keyword">echo</span> get_option<span class="php-brackets">(</span><span class="php-string">'rss_language'</span><span class="php-brackets">)</span>; <span class="php-script-tag">?&gt;<span class="html"><span class="html-other-element">&lt;/language&gt;</span>
		<span class="html-other-element">&lt;sy:updatePeriod&gt;</span></span>&lt;?php</span> <span class="php-keyword">echo</span> apply_filters<span class="php-brackets">(</span> <span class="php-string">'rss_update_period'</span>, <span class="php-string">'hourly'</span> <span class="php-brackets">)</span>; <span class="php-script-tag">?&gt;<span class="html"><span class="html-other-element">&lt;/sy:updatePeriod&gt;</span>
		<span class="html-other-element">&lt;sy:updateFrequency&gt;</span></span>&lt;?php</span> <span class="php-keyword">echo</span> apply_filters<span class="php-brackets">(</span> <span class="php-string">'rss_update_frequency'</span>, <span class="php-string">'1'</span> <span class="php-brackets">)</span>; <span class="php-script-tag">?&gt;<span class="html"><span class="html-other-element">&lt;/sy:updateFrequency&gt;</span>

		<span class="html-other-element">&lt;item&gt;</span>
		<span class="html-other-element">&lt;/item&gt;</span>

	<span class="html-other-element">&lt;/channel&gt;</span>
<span class="html-other-element">&lt;/rss&gt;</span></span></span></span></pre>
</div>
<p>Now, you could see the &lt;item&gt; and &lt;/item&gt; tags, that is where we are going to add our feed items. From this moment I assume that all our RSS data is located in an array like this one.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre>
<pre><span class="php"><span class="php-var">$rssItems</span> <span class="php-operator">=</span> <span class="php-keyword">array</span><span class="php-brackets">(</span>
	<span class="php-string">'item_1'</span><span class="php-operator">=</span><span class="php-operator">&gt;</span><span class="php-keyword">array</span><span class="php-brackets">(</span>
		<span class="php-string">'Title'</span>,
		<span class="php-string">'Link'</span>,
		<span class="php-string">'Author'</span>,
		<span class="php-string">'Date'</span>,
		<span class="php-string">'Description'</span>,
		<span class="php-string">'Content'</span>
		<span class="php-brackets">)</span>,
	<span class="php-string">'item_2'</span><span class="php-operator">=</span><span class="php-operator">&gt;</span><span class="php-keyword">array</span><span class="php-brackets">(</span>
		<span class="php-string">'Title'</span>,
		<span class="php-string">'Link'</span>,
		<span class="php-string">'Author'</span>,
		<span class="php-string">'Date'</span>,
		<span class="php-string">'Description'</span>,
		<span class="php-string">'Content'</span>
		<span class="php-brackets">)</span>
	<span class="php-brackets">)</span>;</span></pre>
</div>
<p>And so on. For adding the items to our feed, we simply use a foreach loop.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre>
<pre><span class="php"><span class="php-keyword">foreach</span> <span class="php-brackets">(</span><span class="php-var">$rssItems</span> <span class="php-keyword">as</span> <span class="php-var">$item</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>
	<span class="php-keyword">echo</span> <span class="php-string">'&lt;item&gt;'</span>;
	<span class="php-keyword">echo</span> <span class="php-string">'&lt;title&gt;'</span> <span class="php-operator">.</span> <span class="php-var">$item</span><span class="php-brackets">[</span><span class="php-string">'Title'</span><span class="php-brackets">]</span> <span class="php-operator">.</span> <span class="php-string">'&lt;/title&gt;'</span>;
	<span class="php-keyword">echo</span> <span class="php-string">'&lt;link&gt;'</span> <span class="php-operator">.</span> <span class="php-var">$item</span><span class="php-brackets">[</span><span class="php-string">'Link'</span><span class="php-brackets">]</span> <span class="php-operator">.</span> <span class="php-string">'&lt;/link&gt;'</span>;
	<span class="php-keyword">echo</span> <span class="php-string">'&lt;dc:creator&gt;'</span> <span class="php-operator">.</span> <span class="php-var">$item</span><span class="php-brackets">[</span><span class="php-string">'Author'</span><span class="php-brackets">]</span> <span class="php-operator">.</span> <span class="php-string">'&lt;/dc:creator&gt;'</span>;
	<span class="php-keyword">echo</span> <span class="php-string">'&lt;pubDate&gt;'</span> <span class="php-operator">.</span> mysql<span class="php-number">2</span>date<span class="php-brackets">(</span><span class="php-string">'D, d M Y H:i:s +0000'</span>, <span class="php-var">$item</span><span class="php-brackets">[</span><span class="php-string">'Date'</span><span class="php-brackets">]</span><span class="php-brackets">)</span> <span class="php-operator">.</span> <span class="php-string">'&lt;/pubDate&gt;'</span>;
	<span class="php-keyword">echo</span> <span class="php-string">'&lt;description&gt;'</span> <span class="php-operator">.</span> <span class="php-var">$item</span><span class="php-brackets">[</span><span class="php-string">'Description'</span><span class="php-brackets">]</span> <span class="php-operator">.</span> <span class="php-string">'&lt;/description&gt;'</span>;
	<span class="php-keyword">echo</span> <span class="php-string">'&lt;content:encoded&gt;&lt;![CDATA['</span> <span class="php-operator">.</span> <span class="php-var">$item</span><span class="php-brackets">[</span><span class="php-string">'Content'</span><span class="php-brackets">]</span> <span class="php-operator">.</span> <span class="php-string">']]&gt;&lt;/content:encoded&gt;'</span>;
	<span class="php-keyword">echo</span> <span class="php-string">'&lt;/item&gt;'</span>;
<span class="php-brackets">}</span></span></pre>
</div>
<p>The mysql2date function is a WordPress function that converts our date to the format we want for our feed. The input should be the date in the following format: <code>d-m-Y H:i:s</code>. See <a href="http://php.net/date">php.net</a> for more information about the date formatting.</p>
<p>Now we have finished our function, we have only one thing to do.</p>
<h3>Adding the RSS Feed to WordPress</h3>
<p>To add the feed, we could use one simple function, build-in in WordPress since version <code>2.1.0</code>. This is the <code>add_feed</code> function. This function has two parameters.</p>
<ul>
<li>$feedname; The name of your feed.</li>
<li>$function; The function that creates the feed. (The one we created above)</li>
</ul>
<p>So lets say we name our feed: &#8216;guestbook&#8217;, then we should call the <code>add_feed</code> function this way:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
</pre>
<pre><span class="php"><span class="php-script-tag">&lt;?php</span>
<span class="php-comment">// Add our new RSS feed.
</span>
add_feed<span class="php-brackets">(</span><span class="php-string">'guestbook'</span>, <span class="php-string">'myGreatPluginRSSFeed'</span><span class="php-brackets">)</span>;
<span class="php-script-tag">?&gt;<span class="html"></span></span></span></pre>
</div>
<p>Now our feed is added and working! One thing you might be asking yourself is: Where could I find my feed? Well, that&#8217;s simple.<br />
If you are using permalinks on your blog (could be checked this way: <code>$wp_rewrite->using_permalinks()</code>), then your feed is located at: http://your.website.com/[feedname].<br />
If you don&#8217;t use permalinks, your feed is located at: http://your.website.com/?feed=[feedname].</p>
<h3>Done!</h3>
<p>After all our hard work, we have created one beautiful RSS 2.0 feed, working with WordPress. Any questions? Please <a href="http://www.frank-verhoeven.com/create-an-rss-feed-with-wordpress/#respond">leave a comment</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/create-an-rss-feed-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Using Sessions in WordPress</title>
		<link>http://www.frank-verhoeven.com/using-session-in-wordpress/</link>
		<comments>http://www.frank-verhoeven.com/using-session-in-wordpress/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 13:03:54 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=158</guid>
		<description><![CDATA[Yesterday, when I was creating a new plugin for my friend Stefan Vervoort, I needed sessions to work. Unfortunately, WordPress doesn&#8217;t support them?! I searched the whole source code of this great piece of blogging software, and not on one single line I found even one session. Also the session_start() function is not called, but [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, when I was creating a new plugin for my friend <a href="http://www.divitodesign.com/">Stefan Vervoort</a>, I needed sessions to work. Unfortunately, WordPress doesn&#8217;t support them?!</p>
<p>I searched the whole source code of this great piece of blogging software, and not on one single line I found even one session. Also the <a href="http://www.php.net/session_start">session_start()</a> function is not called, but I still needed my sessions to work <img src='http://www.frank-verhoeven.com/wp-includes/images/smilies/icon_confused.gif' alt=':-?' class='wp-smiley' />  .</p>
<p>So I started searching Google for a fix of my problem. I found a lot of people asking the same question: &#8220;Why do sessions not work in WordPress?&#8221; Finally I found a solution to fix this little issue and guess what, it is a simple one.<br />
<span id="more-158"></span></p>
<h3>The Solution</h3>
<p>The only thing you have to do is call session_start(); before any output is send to the client. Now you might think: Nice, but what happens when I upgrade my WordPress installation to the latest version? Well, yes, your changes will be lost. That is the reason why we first should think of where to add these changes..</p>
<p>Normally upgrading your installation will replace all files, except one. Yes, it is the wp-config.php file. And even better, there isn&#8217;t send any output to a client yet, when this file is loaded.</p>
<p>So, we add the next lines of code to our wp-config.php file:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
</pre>
<pre><span class="php"><span class="php-comment">/**
 *  Enable sessions
 */</span>
<span class="php-keyword">if</span> <span class="php-brackets">(</span><span class="php-operator">!</span><span class="php-function">session_id</span><span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-brackets">)</span>
    <span class="php-function">session_start</span><span class="php-brackets">(</span><span class="php-brackets">)</span>;</span></pre>
</div>
<p>And sessions are enabled on your blog!<br />
I think the best place to add these lines is at the top of the config file, so immediately after the php starting tag (&lt;?php).</p>
<p>I hope this will help you out when facing the same problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/using-session-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>91</slash:comments>
		</item>
	</channel>
</rss>

