<?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>ZENVERSE &#187; wordpress</title>
	<atom:link href="http://zenverse.net/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://zenverse.net</link>
	<description>Design and Web Development</description>
	<lastBuildDate>Mon, 26 Jul 2010 13:01:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Creating A Simple Wordpress Plugin That Modifies Post Content</title>
		<link>http://zenverse.net/creating-a-simple-wordpress-plugin-that-modifies-post-content/</link>
		<comments>http://zenverse.net/creating-a-simple-wordpress-plugin-that-modifies-post-content/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 09:14:21 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=1648</guid>
		<description><![CDATA[In some occasion, you might need to add a same piece of codes to your blog posts over and over again, and when you need to make changes to them, you need to manually change all of them. This is very tedious. Not anymore, if you make a plugin that does the purpose. ]]></description>
			<content:encoded><![CDATA[<p>In some occasion, you might need to add a same piece of codes to your blog posts over and over again, and when you need to make changes to them, you need to manually change all of them. This is very tedious. Not anymore, if you make a plugin that does the purpose. </p>
<p>In this guide, we are going to create a simple plugin that scan through the post content for &#8220;{donationcode}&#8221; and replace it with our paypal donation codes. <a href="#completecode">Jump to complete code</a></p>
<h3>1. Creating a new plugin php file</h3>
<p>We created a file called <em>simple_replacer.php</em> and put it into <em>wp-content/plugins/simple_replacer/</em> folder.</p>
<h3>2. The plugin header</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1648code1'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p16481"><td class="code" id="p1648code1"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Plugin Name: Simple Replacer
Plugin URI: link to your page to download the plugin or usage guide
Description: Replaces {donationcode} with paypal donation codes
Author: Zen
Version: 1.0
Author URI: http://zenverse.net/
*/</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h3>3. Adding a function that does the replacing work</h3>
<p>Type these codes into the file after the header part (after */)</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1648code2'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p16482"><td class="code" id="p1648code2"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> the_replacer<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'{donationcode}'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'YOUR_DONATION_HTML_CODES'</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>NOTE:<br />
Without returning the variable $content, you will ruin the whole post content (return empty content), so make sure you include the &#8220;return&#8221; line.</p>
<h3>4. Adding filter, let wordpress know what we want to do</h3>
<p>Add this, 1 line before the php closing tag (?>)</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1648code3'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p16483"><td class="code" id="p1648code3"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'the_replacer'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//if you want to run the function on excerpts too, uncomment the line below</span>
<span style="color: #666666; font-style: italic;">//add_filter('the_excerpt', 'the_replacer');</span></pre></td></tr></table></div>

<p>NOTE:<br />
The function name &#8220;the_replacer&#8221; must match the php function that you created in step 3.</p>
<h3><a name="completecode"></a>The Complete Code</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1648code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p16484"><td class="code" id="p1648code4"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Plugin Name: Simple Replacer
Plugin URI: link to your page to download the plugin or usage guide
Description: Replaces {donationcode} with paypal donation codes
Author: Zen
Version: 1.0
Author URI: http://zenverse.net/
*/</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> the_replacer<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'{donationcode}'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'YOUR_DONATION_HTML_CODES'</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'the_replacer'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//if you want to run the function on excerpts too, uncomment the line below</span>
<span style="color: #666666; font-style: italic;">//add_filter('the_excerpt', 'the_replacer');</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>That&#8217;s it. </p>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/creating-a-simple-wordpress-plugin-that-modifies-post-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Post Thumbnail Feature to your Wordpress Theme</title>
		<link>http://zenverse.net/adding-post-thumbnail-feature-to-your-wordpress-theme/</link>
		<comments>http://zenverse.net/adding-post-thumbnail-feature-to-your-wordpress-theme/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 13:26:26 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=1512</guid>
		<description><![CDATA[Wordpress added a new major feature in version 2.9 - The Post Thumbnail. Now everyone can easily make your website looks more magazine-like and professional. I will show you how to add the feature to your theme within 5 minutes.]]></description>
			<content:encoded><![CDATA[<p>Wordpress added a new major feature in version 2.9 &#8211; The Post Thumbnail. Now everyone can easily make your website looks more magazine-like and professional. I will show you how to add the feature to your theme within 5 minutes.</p>
<h3>1. Adding codes to The Loop</h3>
<p>First of all, if you do not know what is The Loop, please refer to this <a target="_blank" rel="nofollow" href="http://codex.wordpress.org/The_Loop">page</a>.</p>
<p>Open up index.php, look for:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1512code5'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p15125"><td class="code" id="p1512code5"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_excerpt<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>or, your theme may be using this instead of that above:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1512code6'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p15126"><td class="code" id="p1512code6"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Add these codes <strong>just before</strong> the &#8220;the_excerpt&#8221; or &#8220;the_content&#8221; line :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1512code7'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p15127"><td class="code" id="p1512code7"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'has_post_thumbnail'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> has_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php the_permalink(); ?&gt;&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_post_thumbnail<span style="color: #009900;">&#40;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> 150<span style="color: #339933;">,</span> 150 <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'alignleft'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><u>Explaination:</u></p>
<ul>
<li>The first line check whether &#8220;has_post_thumbnail&#8221; function exists before running the code, so that it wouldn&#8217;t causes fatal error in older wordpress version.</li>
<li><em>has_post_thumbnail</em> is the function that determine whether your post has post thumbnail</li>
<li><em>the_post_thumbnail </em>is the function that output the post thumbnail &lt;img> tag</li>
</ul>
<p>.</p>
<h3>2. Using the_post_thumbnail()</h3>
<p>According to the <a href="http://codex.wordpress.org/Template_Tags/the_post_thumbnail" target="_blank" rel="nofollow">wordpress codex</a>, the function&#8217;s usage is:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1512code8'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p15128"><td class="code" id="p1512code8"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_post_thumbnail<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$size</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attr</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>It can accept 2 arguments. The first argument is the thumbnail size and the second argument is the image&#8217;s attributes.</p>
<p><b>Based on the example in part 1</b><br />
I used to specify the thumbnail size in array form, like in the above example (a square thumbnail of 150 pixels).</p>
<p>For the second argument, I added <i>.alignleft</i> class to the thumbnail so that it floats left. You can add more attributes like this too:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1512code9'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p15129"><td class="code" id="p1512code9"><pre class="php" style="font-family:monospace;">the_post_thumbnail<span style="color: #009900;">&#40;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> 150<span style="color: #339933;">,</span> 150 <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'alignleft'</span> <span style="color: #339933;">,</span> style<span style="color: #0000ff;">' =&gt; '</span>border<span style="color: #339933;">:</span>1px solid red <span style="color: #339933;">;</span> margin<span style="color: #339933;">-</span>right<span style="color: #339933;">:</span>5px <span style="color: #339933;">;</span><span style="color: #0000ff;">' ) );</span></pre></td></tr></table></div>

<h3>3. Make your theme support post thumbnail</h3>
<p>Open functions.php, scroll to the most bottom and add this before ?> (the closing php tag) :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1512code10'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p151210"><td class="code" id="p1512code10"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'add_theme_support'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
add_theme_support<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'post-thumbnails'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Visit your admin panel and edit/create a post, you will then notice a new box called &#8220;Post Thumbnail&#8221; appear at the bottom right corner. You can add thumbnail there.</p>
<h3>4. I need rectangle thumbnail</h3>
<p>When you upload a thumbnail, wordpress generates only square thumbnails. What if you need rectangle thumbnail in your theme?</p>
<p>In your functions.php, look for:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1512code11'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p151211"><td class="code" id="p1512code11"><pre class="php" style="font-family:monospace;">add_theme_support<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'post-thumbnails'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>After that, add this in the next line:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1512code12'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p151212"><td class="code" id="p1512code12"><pre class="php" style="font-family:monospace;">set_post_thumbnail_size<span style="color: #009900;">&#40;</span> 300<span style="color: #339933;">,</span> 100<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The first argument is width, second is height and the third is crop_flag (if true, wordpress will crop it upon creating the thumbnail, instead of resizing)</p>
<p>From now on, wordpress will generate an additional rectangle thumbnail of size 300 x 100 pixels everytime you upload image. </p>
<p>Okay, you might ask, what about my old uploaded images? I want each of them to have a rectangle thumbnail too. Fortunately, there is a plugin called &#8220;Regenerate Thumbnails&#8221; which can do the job for you automatically.</p>
<p>Hope this helps <img src='http://zenverse.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/adding-post-thumbnail-feature-to-your-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fatal Error When Using has_post_image() and the_post_image()</title>
		<link>http://zenverse.net/fatal-error-when-using-has_post_image-and-the_post_image/</link>
		<comments>http://zenverse.net/fatal-error-when-using-has_post_image-and-the_post_image/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 04:34:38 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=1432</guid>
		<description><![CDATA[If you followed guides for the new post thumbnail feature before Wordpress 2.9 is out, they might tell you to paste this codes (or similar) into <strong>The Loop</strong>. However, the functions names actually changed when Wordpress 2.9 is out.]]></description>
			<content:encoded><![CDATA[<p>If you followed guides for the new post thumbnail feature before Wordpress 2.9 is out, they might tell you to paste this codes (or similar) into <strong>The Loop</strong>.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1432code13'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p143213"><td class="code" id="p1432code13"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> has_post_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php the_permalink(); ?&gt;&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_post_image<span style="color: #009900;">&#40;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> 125<span style="color: #339933;">,</span> 125 <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'alignleft'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>However, the function names above were based on wordpress 2.9 RC1. The functions names actually changed when Wordpress 2.9 is out. </p>
<ul>
<li>has_post_image() -> has_post_thumbnail()</li>
<li>the_post_image() -> the_post_thumbnail()</li>
</ul>
<p>So the codes you need to use is:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1432code14'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p143214"><td class="code" id="p1432code14"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> has_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php the_permalink(); ?&gt;&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_post_thumbnail<span style="color: #009900;">&#40;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> 125<span style="color: #339933;">,</span> 125 <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'alignleft'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>That&#8217;s it.</p>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/fatal-error-when-using-has_post_image-and-the_post_image/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wordpress 2.9 Carmen With Exciting New Features</title>
		<link>http://zenverse.net/wordpress-2-9-carmen/</link>
		<comments>http://zenverse.net/wordpress-2-9-carmen/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 07:17:58 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=1413</guid>
		<description><![CDATA[WordPress version 2.9 "Carmen" named in honor of magical jazz vocalist <a rel="nofollow" target="_blank" href="http://www.carmenmcrae.com/">Carmen McRae</a> is available for download. I will soon check and make required changes for all my themes.]]></description>
			<content:encoded><![CDATA[<p>WordPress version 2.9 &#8220;Carmen&#8221; named in honor of magical jazz vocalist <a rel="nofollow" target="_blank" href="http://www.carmenmcrae.com/">Carmen McRae</a> is available for download. I will soon check and make required changes for all my themes.</p>
<h3>New Major Features</h3>
<ul>
<li><strong>&#8220;Trash&#8221; feature</strong>, if you accidentally delete a post or comment you can bring it back, just like your OS.</li>
<li><strong>Built-in image editor</strong> that allows you to crop, edit, rotate, flip, and scale your images.</li>
<li><strong>Batch plugin update and compatibility checking</strong> which means you can update 10 plugins at once</li>
<li><strong>Easier video embeds</strong> that allow you to just paste a URL on its own line and have it magically turn it into the proper embed code.</li>
<li><strong>Custom post types</strong> so you can juggle more types than just post, page, and attachment.</li>
<li><strong>Sidebars can now have descriptions</strong> so it’s more obvious what and where they do what they do.</li>
<li><strong>Automatic database optimization support</strong>, which you can enable in your wp-config.php file by adding define(&#8217;WP_ALLOW_REPAIR&#8217;, true);.</li>
<li><strong>Rel=canonical support for better SEO</strong>. <a rel="nofollow" target="_blank" href="http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html">What is rel=&#8221;canonical&#8221;?</a></li>
<li><strong>Themes can register &#8220;post thumbnails&#8221;</strong> which allow them to attach an image to the post.</li>
<li>When you’re editing files in the theme and plugin editors it remembers your location and takes you back to that line after you save.</li>
</ul>
<h3>More Info &#038; Links</h3>
<ul>
<li><a rel="nofollow" target="_blank" href="http://wordpress.org/development/2009/12/wordpress-2-9/">Video and full list of new features in WordPress 2.9 @ Official Dev Blog</a></li>
<li><a rel="nofollow" target="_blank" href="http://wordpress.org/download/">Download Wordpress 2.9</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/wordpress-2-9-carmen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using Template Tag Function in Wordpress Theme Demo Bar Plugin</title>
		<link>http://zenverse.net/using-template-tag-function-in-wordpress-theme-demo-bar-plugin/</link>
		<comments>http://zenverse.net/using-template-tag-function-in-wordpress-theme-demo-bar-plugin/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 09:23:18 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=874</guid>
		<description><![CDATA[Explains the template tag functions for wordpress theme demo bar plugin. Currently there are:
<ul>
<li>wptdb_output()</li>
<li>wptdb_list_themes()</li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>This page is created for <a target="_blank" href="http://zenverse.net/wordpress-theme-demo-bar-plugin/">Wordpress Theme Demo Bar</a> plugin.</p>
<blockquote><p>There are 2 functions available : </p>
<ul>
<li><a href="#wptdb_output">wptdb_output()</a></li>
<li><a href="#wptdb_list_themes">wptdb_list_themes()</a></li>
</ul>
</blockquote>
<h3>Function : wptdb_output()<a name="wptdb_output"></a></h3>
<p>Please read &#8221; <a target="_blank" href="http://zenverse.net/using-shortcode-in-wordpress-theme-demo-bar-plugin/">Using shortcode</a> &#8221; first to understand this page better.</p>
<h5>Description</h5>
<p>Allows you to output theme info in template files instead of using shortcode in post. It accepts argument in strings and works exactly like the shortcode <img style="vertical-align:middle" src="http://zenverse.net/wp-content/uploads/2009/09/demobar_shortcode.gif" alt="" />. Introduced in version 1.4.</p>
<h5>Usage</h5>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p874code15'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p87415"><td class="code" id="p874code15"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wptdb_output'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
wptdb_output<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h5>Parameters</h5>
<p><strong>theme</strong><br />
(<em>string</em>) The theme&#8217;s folder name. Must be set.</p>
<p><strong>format</strong><br />
(<em>string</em>) Format id. Default format will be used if you give an invalid format id.</p>
<p><strong>get</strong><br />
(<em>string</em>) Get single info instead of using format.<br />
Valid values : <a target="_blank" rel="nofollow" href="http://zenverse.net/wp-content/plugins/wordpress-theme-demo-bar/listoftags.html">All available tags</a></p>
<p><strong>autop</strong><br />
(<em>string</em>) Auto wrap the content with HTML paragraph &lt;p> tag</p>
<ul>
<li>true &#8211; default</li>
<li>false / 0 (to display content inline)</li>
</ul>
<p><strong>echo</strong><br />
(<em>string</em>) Show the result or keep it in a variable. Default is true.</p>
<ul>
<li>1 (true) &#8211; default</li>
<li>0 (false)</li>
</ul>
<h5>Example of Usage</h5>
<p><strong>Display format id of 1</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p874code16'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p87416"><td class="code" id="p874code16"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wptdb_output'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
wptdb_output<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'theme=my-theme-folder-name&amp;format=1'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>Display number of previews (inline)</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p874code17'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p87417"><td class="code" id="p874code17"><pre class="php" style="font-family:monospace;">Lunated theme has <span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wptdb_output'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
wptdb_output<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'theme=lunated&amp;get=hits&amp;autop=false'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span> previews in total<span style="color: #339933;">.</span></pre></td></tr></table></div>

<p><strong>Assign to variable</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p874code18'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p87418"><td class="code" id="p874code18"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wptdb_output'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$stored</span> <span style="color: #339933;">=</span> wptdb_output<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'theme=lunated&amp;get=today&amp;echo=0'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$stored</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>Argument in array form</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p874code19'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p87419"><td class="code" id="p874code19"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wptdb_output'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$stored</span> <span style="color: #339933;">=</span> wptdb_output<span style="color: #009900;">&#40;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'theme'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'lunated'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'get'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'today'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'echo'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$stored</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h3>Function : wptdb_list_themes()<a name="wptdb_list_themes"></a></h3>
<h5>Description</h5>
<p>Allows you to display a drop-down menu (&lt;select>) for visitors to choose and preview your non-private themes. Introduced in version 1.5</p>
<h5>Usage</h5>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p874code20'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p87420"><td class="code" id="p874code20"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wptdb_list_themes'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
wptdb_list_themes<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h5>Parameters</h5>
<p><strong>style</strong><br />
(<em>string</em>) Type of output. Default is &#8220;option&#8221; which output &lt;option> to be used with &lt;select>. Valid values:</p>
<ul>
<li>option &#8211; default</li>
</ul>
<p><strong>hierarchical</strong><br />
(<em>string</em>) Show parent-child relationship. Default is true. Valid values:</p>
<ul>
<li>1 / true (true) &#8211; default</li>
<li>0 / false (false)</li>
</ul>
<p><strong>orderby</strong><br />
(<em>string</em>) Sort themes by wordpress default method or by number of previews. Valid values:</p>
<ul>
<li>default &#8211; default</li>
<li>hits</li>
</ul>
<p><strong>order</strong><br />
(<em>string</em>) Sort order for themes (either ascending or descending). Default is asc. Valid values:</p>
<ul>
<li>asc &#8211; default</li>
<li>desc</li>
</ul>
<p><strong>show_hits</strong><br />
(<em>string</em>) Show number of previews beside theme name in a bracket. Default is false. Valid values:</p>
<ul>
<li>true / 1</li>
<li>false / 0 &#8211; default</li>
</ul>
<p><strong>echo</strong><br />
(<em>string</em>) Show the result or keep it in a variable. Default is true.</p>
<ul>
<li>1 (true) &#8211; default</li>
<li>0 (false)</li>
</ul>
<h5>Example of Usage</h5>
<p><strong>Display drop-down menu using default settings</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p874code21'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p87421"><td class="code" id="p874code21"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wptdb_list_themes'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;select name=&quot;&quot;&gt;'</span><span style="color: #339933;">;</span>
wptdb_list_themes<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/select&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>Display drop-down menu , sort the themes by number of previews in descending order</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p874code22'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p87422"><td class="code" id="p874code22"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wptdb_list_themes'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;select name=&quot;&quot;&gt;'</span><span style="color: #339933;">;</span>
wptdb_list_themes<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'orderby=hits&amp;order=desc'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/select&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>Display drop-down menu with number of previews shown beside the theme name</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p874code23'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p87423"><td class="code" id="p874code23"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wptdb_list_themes'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;select name=&quot;&quot;&gt;'</span><span style="color: #339933;">;</span>
wptdb_list_themes<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'show_hits=1'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/select&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>Argument in array form</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p874code24'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p87424"><td class="code" id="p874code24"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wptdb_list_themes'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;select name=&quot;&quot;&gt;'</span><span style="color: #339933;">;</span>
wptdb_list_themes<span style="color: #009900;">&#40;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'orderby'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'hits'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'order'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'desc'</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/select&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/using-template-tag-function-in-wordpress-theme-demo-bar-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding &amp; Using Shortcode in Wordpress Theme Demo Bar Plugin</title>
		<link>http://zenverse.net/using-shortcode-in-wordpress-theme-demo-bar-plugin/</link>
		<comments>http://zenverse.net/using-shortcode-in-wordpress-theme-demo-bar-plugin/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 05:35:35 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=841</guid>
		<description><![CDATA[Since version 1.4, you can display theme info such as number of previews and theme preview URL in posts and pages using shortcode. To make the process easier, use Media Button (see screenshot for more info)]]></description>
			<content:encoded><![CDATA[<p>This page is created for <a target="_blank" href="http://zenverse.net/wordpress-theme-demo-bar-plugin/">Wordpress Theme Demo Bar</a> plugin. Shortcode is introduced in version 1.4.</p>
<h5>What can you do with shortcode <img style="vertical-align:middle" src="http://zenverse.net/wp-content/uploads/2009/09/demobar_shortcode.gif" alt="" />?</h5>
<p>You can display theme info such as number of previews in posts and pages. You can output anything within these <a target="_blank" href="http://zenverse.net/wp-content/wordpress-theme-demo-bar/listoftags.html">supported tags</a>:</p>
<ul>
<li>Name of the theme (based on style.css)</li>
<li>Description of the theme (based on style.css)</li>
<li>Theme URI (based on style.css)</li>
<li>Author name (based on style.css)</li>
<li>Version number of the theme (based on style.css)</li>
<li>Folder name of the theme</li>
</li>
<li>URL to preview the theme (?themedemo=xxx)</li>
<li>Total no. of previews</li>
<li>URL to theme&#8217;s screenshot file</li>
<li>URL to the theme&#8217;s info page (if exist)</li>
<li>URL to the theme&#8217;s download page (if exist)</li>
<li>URL to the page to buy the theme (if exist)</li>
</ul>
<h5>Example of what you can do</h5>
<p><strong>Retrieve the <u>number of previews</u> of my Lunated Theme and display it <u>inline</u></strong></p>
<blockquote><p>Oh. Lunated theme has been previewed 13630 times in total.</p></blockquote>
<p><strong>Make a preview link to Lunated theme using default format</strong></p>
<blockquote><p><a title="Lunated has been previewed 13630 times." href="/?themedemo=lunated">Preview Lunated (13630)</a></p>
</blockquote>
<h5>Understanding and Using Shortcode</h5>
<li>Generally, you need to specify the theme folder name like: <img style="vertical-align:middle" src="http://zenverse.net/wp-content/uploads/2009/09/wptdb_sc_guide_00.gif" alt="" /></li>
<li>To make it easier, you can use the media button (see screenshot for more info) and follow the steps given.</li>
<p>To understand more about the shortcode <img style="vertical-align:middle" src="http://zenverse.net/wp-content/uploads/2009/09/demobar_shortcode.gif" alt="" /> and examples:</p>
<blockquote>
<h5>1. Get Single Info only</h5>
<p><strong>Use attribute &#8216;get&#8217; to return only a single infomation</strong></p>
<p><strong>Valid values of attribute &#8216;get&#8217; :</strong><br />
<a name="tags"></a><a target="_blank" rel="nofollow" href="http://zenverse.net/wp-content/plugins/wordpress-theme-demo-bar/listoftags.html">All tags available</a> are the valid values of attribute &#8216;get&#8217;. However, you can only use one tag at once. (without curly bracket of course)</p>
<p><strong>Example:</strong></p>
<ul>
<li>Get number of previews of my Lunated theme and display it inline<br />
<img src="http://zenverse.net/wp-content/uploads/2009/09/wptdb_sc_guide_01.gif" alt="" /></li>
<li>Get URL to screenshot file of my Lunated theme and display it inline<br />
<img src="http://zenverse.net/wp-content/uploads/2009/09/wptdb_sc_guide_02.gif" alt="" /></li>
</ul>
<p><strong>You can use media button to make the whole process a lot easier.</strong>
</p></blockquote>
<blockquote>
<h5>2. Formatted Output &#8211; return output based on format id</h5>
<p><strong>use attribute &#8216;format&#8217;</strong></p>
<p><strong>you can create and save a new format at plugin option page</strong></p>
<p><strong>Default format is : &lt;a title=&quot;{name} has been previewed {hits} times&quot; href=&quot;{demo}&quot;>Preview {name} ({hits})&lt;/a></strong></p>
<p><strong>Example:</strong></p>
<ul>
<li>Display using default format (you don&#8217;t have to specify the format id)<br />
<img style="vertical-align:middle" src="http://zenverse.net/wp-content/uploads/2009/09/wptdb_sc_guide_00.gif" alt="" /></li>
<li>Display using format id 1<br />
<img src="http://zenverse.net/wp-content/uploads/2009/09/wptdb_sc_guide_03.gif" alt="" /></li>
</ul>
<p><strong>You can use media button to make the whole process a lot easier.</strong>
</p></blockquote>
<blockquote>
<h5>3. Auto wrap output content with HTML paragraph &lt;p> tag</h5>
<p><strong>use attribute &#8216;autop&#8217;</strong></p>
<p><strong>by default autop is set to true, which means it automatically wrap the output content with &lt;p> tags</strong></p>
<p><strong>To display the content inline, use autop=&#8221;false&#8221;</strong></p>
<p><strong>Example:</strong><br />
<img src="http://zenverse.net/wp-content/uploads/2009/09/wptdb_sc_guide_01.gif" alt="" />
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/using-shortcode-in-wordpress-theme-demo-bar-plugin/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Old Wordpress Version Under Attack. Upgrade Now!</title>
		<link>http://zenverse.net/old-wordpress-version-under-attacked-upgrade-now/</link>
		<comments>http://zenverse.net/old-wordpress-version-under-attacked-upgrade-now/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 03:06:23 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=768</guid>
		<description><![CDATA[Older version of WordPress are being attacked, so if you are still using wordpress 2.5 or 2.6, its too old and <a href="http://wordpress.org/download/">you must upgrade</a> right now. We are still not sure which versions of WP are vulnerable. Will be updated.]]></description>
			<content:encoded><![CDATA[<p>Older version of WordPress are being attacked, so if you are still using wordpress 2.5 or 2.6, its too old and <a href="http://wordpress.org/download/">you must upgrade</a> right now. All wordpress version 2.8.3 and later <u>should be</u> safe from this attack.</p>
<h5>Signs of the attack</h5>
<ul>
<li>Strange characters in your permalinks (including eval and base64_decode). For example :<br />
<blockquote><p>example.com/category/post-title/%&#038;(%7B$%7Beval(base64_decode($_SERVER%5BHTTP_REFERER%5D))%7D%7D|.+)&#038;%/</p></blockquote>
</li>
<li>Extra administrator account in the users control panel which you cannot see</li>
</ul>
<h5>Check your blog for the signs</h5>
<ul>
<li>Visit your blog index and see if there are any strange permalinks.</li>
<li>Login into admin panel > Users > Check whether the number of Administrator is correct</li>
</ul>
<h5>How to prevent this attack?</h5>
<ul>
<li>Upgrade to the latest version</li>
<li>Change your admin password to a strong password</li>
<li>Change your FTP &#038; mysql password</li>
</ul>
<h5>More Info</h5>
<ul>
<li>More info about this matter at <a href="http://lorelle.wordpress.com/2009/09/04/old-wordpress-versions-under-attack/" target="_blank">Lorelle&#8217;s blog</a></li>
<li><a target="_blank" href="http://wordpress.org/development/2009/09/keep-wordpress-secure/">How to Keep WordPress Secure</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/old-wordpress-version-under-attacked-upgrade-now/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ads Detected While Submitting Theme to Wordpress Themes Directory</title>
		<link>http://zenverse.net/ads-detected-while-submitting-theme-to-wordpress-themes-directory/</link>
		<comments>http://zenverse.net/ads-detected-while-submitting-theme-to-wordpress-themes-directory/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 15:24:45 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=707</guid>
		<description><![CDATA["We've detected ads as part of your theme. They need to be removed before your theme will be allowed into the theme directory."
I got this message above when I submit my theme to wordpress Themes Directory. But the problem is, I do not have any advertisement or sponsored links in that theme. I can't seems to find the solution after some time. Therefore, I..]]></description>
			<content:encoded><![CDATA[<blockquote><p>We&#8217;ve detected ads as part of your theme. They need to be removed before your theme will be allowed into the theme directory.</p></blockquote>
<p>I got this message above when I submit my <a target="_blank" href="http://zenverse.net/lunated-theme/">Lunated theme</a> to <a target="_blank" href="http://wordpress.org/extend/themes/lunated">Wordpress Themes Directory</a>. But the problem is, I do not have any advertisement or sponsored links in that theme.</p>
<p>I can&#8217;t seems to find the solution after some time. Therefore, I created a <a target="_blank" href="http://wordpress.org/support/topic/292030?replies=5">support thread</a> and end up emailed the theme to wordpress team and told them the problem.</p>
<h5>It&#8217;s Him. Hardcoded Google Adsense Codes</h5>
<p>Finally, I got a reply from the team few hours later:</p>
<blockquote><p>The upload process is picking up the hard coded adsense items in your theme (in header.php for instance).  Generally when themes want to support showing ads like this they just provide a way to paste in the ad code.</p></blockquote>
<p>So, in case you got the error message while you submit a theme, you know what to look for.</p>
<h5>What did I mean by Hardcoded Google Adsense Codes?</h5>
<p>It is actually the whole part of javascript provided by google adsense after you&#8217;ve created a new ads.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p707code25'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p70725"><td class="code" id="p707code25"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;!--</span>
google_ad_client <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;pub-&lt;?php echo $zenverse_global_adsense_id; ?&gt;&quot;</span><span style="color: #339933;">;</span>
google_ad_width <span style="color: #339933;">=</span> <span style="color: #CC0000;">468</span><span style="color: #339933;">;</span>
google_ad_height <span style="color: #339933;">=</span> <span style="color: #CC0000;">60</span><span style="color: #339933;">;</span>
google_ad_format <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;468x60_as&quot;</span><span style="color: #339933;">;</span>
google_ad_type <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #339933;">;</span>
google_ad_channel <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
google_color_border <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;82cf1e&quot;</span><span style="color: #339933;">;</span>
google_color_bg <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;82cf1e&quot;</span><span style="color: #339933;">;</span>
google_color_link <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;555555&quot;</span><span style="color: #339933;">;</span>
google_color_text <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;555555&quot;</span><span style="color: #339933;">;</span>
google_color_url <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;555555&quot;</span><span style="color: #339933;">;</span>
google_ui_features <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;rc:0&quot;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">//--&gt;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<h5>Now that I had this problem, what should I do?</h5>
<p>All I wanted is to let save my theme users&#8217; time, allow them to display google ads in a simple way &#8211; by just entering adsense publisher id.</p>
<p>Now that I had this problem, I can do nothing but to remove all adsense codes from the template files and provide a way to paste in the ad code in theme option page.</p>
<p>Last but not least, I&#8217;ve created <a target="_blank" href="http://zenverse.net/wp-content/uploads/2009/09/get-adsense-codes.php">a page for user to get adsense codes for their theme along with recommended background and text colours</a>. Look, I want to save their time again <img src='http://zenverse.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<h5>Things you also need to check</h5>
<p>Beside google adsense, if you have advertisement slots (eg: 125&#215;125 ads at sidebar) in your theme, you might get that message too. You don&#8217;t have to remove the slots, just disable them by default. </p>
<p><!--h5>EDITED ON 3 September 2009</h5-->
<!--Alright, I've wasted my time created the page I mentioned above. Wordpress team still don't let my theme in and this is the message given by them:--></p>
<p><!--blockquote>It&#8217;s okay to have support for ads in your theme, but please do show them by default.</blockquote-->
<p><!--Did they mean I have to show google ads (with my publisher id) by default? So when people use my theme, my ads were there by default! Don't you think this is weird?--></p>
<p><!--Anyway, I am waiting for confirmation from wordpress team.--></p>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/ads-detected-while-submitting-theme-to-wordpress-themes-directory/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Host Your Plugin at Wordpress.org using Subversion (SVN)</title>
		<link>http://zenverse.net/host-your-plugin-at-wordpressorg-using-subversion-svn/</link>
		<comments>http://zenverse.net/host-your-plugin-at-wordpressorg-using-subversion-svn/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 07:24:22 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[host]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[tortoisesvn]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=75</guid>
		<description><![CDATA[A 3-step guide to host your plugin at Wordpress.org and get lots of exposure in this centralized repository.]]></description>
			<content:encoded><![CDATA[<h3>First of all, why should we host our plugin at Wordpress.org?</h3>
<p>According to the <a rel="nofollow" target="_blank" href="http://wordpress.org/extend/plugins/about/">Wordpress Developer Center</a>, </p>
<ul style="list-style:decimal">
<li>Keep track of how many people have downloaded it.</li>
<li>Let people leave comments about your plugin.</li>
<li>Get your plugin rated against all the other cool WordPress plugins.</li>
<li>Give your plugin lots of exposure in this centralized repository.</li>
</ul>
<p>As a conclusion, there is no reason not doing this.</p>
<h3>Let&#8217;s start</h3>
<h4>1. Make a request to host your plugin at Wordpress.org</h4>
<p>You can <a rel="nofollow" target="_blank" href="http://wordpress.org/extend/plugins/add/">make a request here</a>. Of course, before that you must be logged in. If you do not have an account yet, <a rel="nofollow" target="_blank" href="http://wordpress.org/extend/plugins/register.php">register here</a>. After the request submission, wait for an email confirming the status of your request. </p>
<p>Wait for this email (request approved):</p>
<blockquote><p>Your plugin hosting request has been aproved.<br />
Within one hour, you will have access to your SVN repository at<br />
<em>http://svn.wp-plugins.org/YOUR-PLUGIN-NAME/</em><br />
with your WordPress.org/bbPress.org username and password (the same one you use on the forums).</p></blockquote>
<h4>2. Use a SVN Client for easier work</h4>
<p>If you noticed, the &#8220;<a rel="nofollow" target="_blank" href="http://wordpress.org/extend/plugins/about/svn/">Using Subversion page at Wordpress.org</a>&#8221; keeps telling us the commands to add files, etc. It makes the work seems to be complicated. A first-time user would not know where to start.</p>
<p>We can make our life easier by using a SVN client to do the stuff. I am using <a target="_blank" href="http://tortoisesvn.net/downloads">Tortoise SVN for Windows</a> in this example.</p>
<h4>3. Upload your plugin files for the first time</h4>
<p>Make sure your readme.txt follows the <a target="_blank" href="http://wordpress.org/extend/plugins/about/readme.txt">standard</a>. You can <a target="_blank" href="http://wordpress.org/extend/plugins/about/validator/">validate your readme.txt here</a>.</p>
<p>After you&#8217;ve installed Tortoise SVN, </p>
<ul style="list-style:decimal">
<li>Create a new folder at anywhere you like, the folder is the place to store and update your plugin files. (I created my folder in My Documents)</li>
<li>Go into the new folder</li>
<li>Right-click and choose SVN Checkout to retrieve the folders</li>
<li>When prompted, enter the URL given in the email (example: <em>http://svn.wp-plugins.org/YOUR-PLUGIN-NAME/</em>)</li>
<li>When prompted, login using account details you registered at Wordpress Extend just now</li>
<li>Wait for it to load and you will notice that 3 folders (trunk, tags, branches) has been added to your new folder</li>
<li>Go into &#8220;TRUNK&#8221; folder, Trunk is the place to store your latest plugin files.</li>
<li>Move ALL your plugin files into &#8220;trunk&#8221;</li>
<li>Right click at anywhere and choose SVN Commit to synchronize your files with Wordpress.org</li>
</ul>
<h5>Side Notes</h5>
<p>Upload the files to &#8220;trunk&#8221; folder without any extra folder and do not zip the files (that&#8217;s Wordpress&#8217;s job). See below:</p>
<blockquote><p>An example of uploaded content:<br />
- trunk/readme.txt<br />
- trunk/plugin.php</p></blockquote>
<h4>4. Done</h4>
<p>We&#8217;ve finished the first upload. Now wait for the update that runs every 15 minutes. After that, try searching for your plugin at <a target="_blank" href="http://wordpress.org/extend/plugins/">Wordpress Plugins Directory</a>.</p>
<h3>That&#8217;s all. Well, not yet.</h3>
<p>There is some work you need to do whenever you released a new version or edit the files. We will cover that in the next part. Coming soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/host-your-plugin-at-wordpressorg-using-subversion-svn/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Dynamic Sidebars (widget-ready theme) in WordPress</title>
		<link>http://zenverse.net/creating-dynamic-sidebars-in-wordpress/</link>
		<comments>http://zenverse.net/creating-dynamic-sidebars-in-wordpress/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 17:13:55 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[dynamic sidebar]]></category>
		<category><![CDATA[sidebar]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=39</guid>
		<description><![CDATA[A step-by-step guide to create dynamic sidebars for your wordpress theme, making your theme widget-ready.]]></description>
			<content:encoded><![CDATA[<h3>What is dynamic sidebar?</h3>
<p>Dynamic sidebar is &#8220;dynamic&#8221;, it simply means that your sidebar can be customised easily by adding / removing widgets in admin panel. If your theme has dynamic sidebar, you can called it a widget-ready theme.</p>
<h3>Step-by-step guide to create dynamic sidebar</h3>
<h4>1. Make sure the HTML codes for your (every) widgets follow a certain format</h4>
<p>This is an example:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code26'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3926"><td class="code" id="p39code26"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;widget&quot;&gt;
    &lt;h2&gt;Categories&lt;/h2&gt;
      &lt;ul&gt;
        &lt;li&gt;Cat #1&lt;/li&gt;
        &lt;li&gt;Cat #2&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
&nbsp;
&lt;div class=&quot;widget&quot;&gt;
    &lt;h2&gt;About&lt;/h2&gt;
    About me About me About me
  &lt;/div&gt;</pre></td></tr></table></div>

<p>In the above example, we can see that every widget is surrounded by &lt;div class=&#8221;widget&#8221;> and its title is surrounded by &lt;h2> tags.</p>
<h4>2. Look for functions.php</h4>
<p>Second, look for functions.php in your theme folder. Create one if it is not there.</p>
<h4>3. Register the dynamic sidebar</h4>
<p>You need to let wordpress know that your theme has a dynamic sidebar. Place these lines of codes into your functions.php:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code27'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3927"><td class="code" id="p39code27"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'register_sidebar'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
register_sidebar<span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'sidebar'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The function uses an array that contains 5 items.<br />
<strong>Name</strong> &#8211; Name of your sidebar<br />
<strong>before_widget</strong> &#8211; the html tags that wraps an invidual widget, eg: div. Put only the opening tag here.<br />
<strong>after_widget</strong> &#8211; if your &#8220;before_widget&#8221; uses a &lt;div> tag, you should use &lt;/div> here<br />
<strong>before_title and after_title</strong> &#8211; html tags surrounding the widget&#8217;s title</p>
<h4>4. Registering the dynamic sidebar : Examples</h4>
<p>If your sidebar look like this:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code28'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3928"><td class="code" id="p39code28"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;rightsidebar&quot;&gt;
&nbsp;
  &lt;div class=&quot;widget&quot;&gt;
    &lt;h2&gt;Recent Posts&lt;/h2&gt;
      &lt;ul&gt;
        &lt;li&gt;Recent Post #1&lt;/li&gt;
        &lt;li&gt;Recent Post #2&lt;/li&gt;
        &lt;li&gt;Recent Post #3&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
&nbsp;
  &lt;div class=&quot;widget&quot;&gt;
    &lt;h2&gt;Categories&lt;/h2&gt;
      &lt;ul&gt;
        &lt;li&gt;Cat #1&lt;/li&gt;
        &lt;li&gt;Cat #2&lt;/li&gt;
        &lt;li&gt;Cat #3&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
&nbsp;
&lt;/div&gt;&lt;!--/rightsidebar--&gt;</pre></td></tr></table></div>

<p>This is how you register your sidebar. (NOTE: ignore the div that wraps the whole sidebar first, we are currently dealing with codes for every single widget)</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code29'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3929"><td class="code" id="p39code29"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'register_sidebar'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
register_sidebar<span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'sidebar'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div class=&quot;widget&quot;&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;h2&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/h2&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Another example: If your sidebar look like this :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code30'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3930"><td class="code" id="p39code30"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;rightsidebar&quot;&gt;
&nbsp;
  &lt;div class=&quot;widget_top&quot;&gt;
    &lt;div class=&quot;widget_title&quot;&gt;Recent Posts&lt;/div&gt;
      &lt;ul&gt;
        &lt;li&gt;Recent Post #1&lt;/li&gt;
        &lt;li&gt;Recent Post #2&lt;/li&gt;
        &lt;li&gt;Recent Post #3&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div class=&quot;widget_foot&quot;&gt;&lt;/div&gt;
&nbsp;
&nbsp;
  &lt;div class=&quot;widget_top&quot;&gt;
    &lt;div class=&quot;widget_title&quot;&gt;Categories&lt;/div&gt;
      &lt;ul&gt;
        &lt;li&gt;Cat #1&lt;/li&gt;
        &lt;li&gt;Cat #2&lt;/li&gt;
        &lt;li&gt;Cat #3&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div class=&quot;widget_foot&quot;&gt;&lt;/div&gt;
&nbsp;
&nbsp;
&lt;/div&gt;&lt;!--/rightsidebar--&gt;</pre></td></tr></table></div>

<p>This is how you register your sidebar.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code31'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3931"><td class="code" id="p39code31"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'register_sidebar'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
register_sidebar<span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'sidebar'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div class=&quot;widget_top&quot;&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/div&gt;&lt;div class=&quot;widget_foot&quot;&gt;&lt;/div&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div class=&quot;widget_title&quot;&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h4>5. Making the sidebar dynamic</h4>
<p>Open sidebar.php. Lets say we have this in our sidebar.php :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code32'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3932"><td class="code" id="p39code32"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;rightsidebar&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;widget&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Recent Posts<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
      <span style="color: #339933;">&lt;</span>ul<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php the_permalink(); ?&gt;&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;bookmark&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      <span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;widget&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Categories<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
      <span style="color: #339933;">&lt;</span>ul<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'show_count=1&amp;title_li='</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      <span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--/</span>rightsidebar<span style="color: #339933;">--&gt;</span></pre></td></tr></table></div>

<p>Now we are going to make it dynamic. Leaves only the sidebar wrapper &lt;div> there.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code33'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3933"><td class="code" id="p39code33"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;rightsidebar&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'dynamic_sidebar'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span>dynamic_sidebar<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sidebar&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--/</span>rightsidebar<span style="color: #339933;">--&gt;</span></pre></td></tr></table></div>

<blockquote><p>Please note that the word &#8220;sidebar&#8221; inside the brackets in <strong>!dynamic_sidebar(&#8221;sidebar&#8221;)</strong> is the name you used when registering the sidebar. </p></blockquote>
<p>It&#8217;s done. Your theme is now widget-ready. However, you might want to make it better.</p>
<h4>5. Prepare your theme for users that don&#8217;t use widgets</h4>
<p>Minority of people don&#8217;t use widgets in Wordpress, we have to include some basic features for them.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code34'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3934"><td class="code" id="p39code34"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;rightsidebar&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'dynamic_sidebar'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span>dynamic_sidebar<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sidebar&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span>
<span style="color: #666666; font-style: italic;">// these codes will be run if they don't use any widget</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// I take the sidebars codes from above example</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;widget&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Recent Posts<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
      <span style="color: #339933;">&lt;</span>ul<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php the_permalink(); ?&gt;&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;bookmark&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      <span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
  <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;widget&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Categories<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
      <span style="color: #339933;">&lt;</span>ul<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'show_count=1&amp;title_li='</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      <span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--/</span>rightsidebar<span style="color: #339933;">--&gt;</span></pre></td></tr></table></div>

<p>Look, we have now included 2 basic features for them: Recent Posts and Categories.</p>
<h4>6. So, your theme has 2 or more sidebars?</h4>
<p>Easy, lets register all of them in functions.php :</p>
<p>Assume you have 2 sidebars with same format  :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code35'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3935"><td class="code" id="p39code35"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'register_sidebars'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
register_sidebars<span style="color: #009900;">&#40;</span>2<span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Sidebar%d'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div class=&quot;widgetobj&quot;&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div class=&quot;widgettitle&quot;&gt;&lt;h3&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/h3&gt;&lt;/div&gt;'</span><span style="color: #339933;">,</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<blockquote><p>Please note that:<br />
- The function used here is <strong>register_sidebar<u>s</u></strong> instead of <strong>register_sidebar</strong>.<br />
-  Change the number &#8220;2&#8243; to the number of sidebars your theme has.<br />
- The %d will be auto replaced by numbers. If you register 2 sidebars, they will be known as <strong>Sidebar1</strong> and <strong>Sidebar2</strong> (in this example). You are going to use the names later.
</p></blockquote>
<p>This is what we have in <strong>sidebar.php</strong> :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code36'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3936"><td class="code" id="p39code36"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;sidebar_1_wrapper&quot;&gt;
&nbsp;
  &lt;div class=&quot;widget&quot;&gt;
    &lt;h2&gt;Recent Posts&lt;/h2&gt;
      &lt;ul&gt;
        &lt;li&gt;Recent Post #1&lt;/li&gt;
        &lt;li&gt;Recent Post #2&lt;/li&gt;
        &lt;li&gt;Recent Post #3&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;  
&nbsp;
&lt;/div&gt;&lt;!--/sidebar_1_wrapper--&gt;
&nbsp;
&lt;div class=&quot;sidebar_2_wrapper&quot;&gt;
&nbsp;
  &lt;div class=&quot;widget&quot;&gt;
    &lt;h2&gt;Recent Posts&lt;/h2&gt;
      &lt;ul&gt;
        &lt;li&gt;Recent Post #1&lt;/li&gt;
        &lt;li&gt;Recent Post #2&lt;/li&gt;
        &lt;li&gt;Recent Post #3&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;  
&nbsp;
&lt;/div&gt;&lt;!--/sidebar_2_wrapper--&gt;</pre></td></tr></table></div>

<p>Now we make them dynamic :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p39code37'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p3937"><td class="code" id="p39code37"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;sidebar_1_wrapper&quot;&gt;
	&lt;?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(&quot;Sidebar1&quot;) ) : ?&gt;
	&lt;?php endif; ?&gt;
&lt;/div&gt;&lt;!--/sidebar_1_wrapper--&gt;
&nbsp;
&lt;div class=&quot;sidebar_2_wrapper&quot;&gt;
  	&lt;?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(&quot;Sidebar2&quot;) ) : ?&gt;
	&lt;?php endif; ?&gt;
&lt;/div&gt;&lt;!--/sidebar_2_wrapper--&gt;</pre></td></tr></table></div>

<blockquote><p>Please note that:<br />
- The name of sidebars you registered were used here.<br />
- Follow step 5 again to prepare your sidebars for users that don&#8217;t use widgets<br />
- If your sidebars do not have same design/format, register them seperately (as in step 3) and make them dynamic like the example just above this.
</p></blockquote>
<h3>That&#8217;s all</h3>
<p>That is all for this tutorial. Please point to me any part that is confusing so that I can make this tutorial better.</p>
<p>Thank you for reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/creating-dynamic-sidebars-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
