<?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 Tips</title>
	<atom:link href="http://zenverse.net/category/wordpress-tutorials/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>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>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>Using Template Tag Function in Wordpress Extend Download Stat Plugin</title>
		<link>http://zenverse.net/using-template-tag-function-in-wordpress-extend-download-stat-plugin/</link>
		<comments>http://zenverse.net/using-template-tag-function-in-wordpress-extend-download-stat-plugin/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 03:12:16 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[template tag]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=697</guid>
		<description><![CDATA[Explains the template tag functions for wordpress extend download stat plugin. Currently there are:
<ul>
<li>wpeds_output()</li>
<li>wpeds_return_data_as_array()</li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>This page is created for <a target="_blank" href="http://zenverse.net/wordpress-extend-download-stat-plugin/">Wordpress Extend Download Stat</a> plugin.</p>
<blockquote><p>There are 2 functions available : </p>
<ul>
<li><a href="#wpeds_output">wpeds_output()</a></li>
<li><a href="#wpeds_return_data_as_array">wpeds_return_data_as_array()</a></li>
</ul>
</blockquote>
<h3>Function : wpeds_output()<a name="wpeds_output"></a></h3>
<p>Please read &#8221; <a target="_blank" href="http://zenverse.net/wordpress-extend-download-stat-plugin/#usage">Using shortcode</a> &#8221; first to understand this page better.</p>
<h5>Description</h5>
<p>Allows you to output download stat in template files instead of using shortcode in post. It can accept argument in string or array and works exactly like the shortcode <img style="vertical-align:middle" src="http://zenverse.net/wp-content/uploads/2009/08/wpeds_guide_00.gif" alt="" />. Introduced in version 1.1</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('p697code26'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p69726"><td class="code" id="p697code26"><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;">'wpeds_output'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
wpeds_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>url</strong><br />
(<em>string</em>) URL to the statistics page. 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-extend-download-stat/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 download stats using 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('p697code27'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p69727"><td class="code" id="p697code27"><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;">'wpeds_output'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
wpeds_output<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'url=http://wordpress.org/extend/plugins/wordpress-theme-demo-bar/stats/&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 download today (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('p697code28'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p69728"><td class="code" id="p697code28"><pre class="php" style="font-family:monospace;">Wordpress Theme Demo Bar got <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;">'wpeds_output'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
wpeds_output<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'url=http://wordpress.org/extend/plugins/wordpress-theme-demo-bar/stats/&amp;get=today&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> downloads today <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('p697code29'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p69729"><td class="code" id="p697code29"><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;">'wpeds_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> wpeds_output<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'url=http://wordpress.org/extend/plugins/wordpress-theme-demo-bar/stats/&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('p697code30'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p69730"><td class="code" id="p697code30"><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;">'wpeds_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> wpeds_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;">'url'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://wordpress.org/extend/plugins/wordpress-theme-demo-bar/stats/'</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 : wpeds_return_data_as_array()<a name="wpeds_return_data_as_array"></a></h3>
<h5>Description</h5>
<p>Allows you to get an array of saved data and assign it to a variable.  It can accept argument in string or array. You can use this function to make a &#8220;download&#8221; page. Introduced in version 1.2.1</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('p697code31'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p69731"><td class="code" id="p697code31"><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;">'wpeds_return_data_as_array'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
wpeds_return_data_as_array<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>url</strong><br />
(<em>string</em>) URL to the statistics page. If set, it returns an array of data of the selected item only. Use var_dump() to see what it has <img src='http://zenverse.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>gettype</strong><br />
(<em>string</em>) If set, it returns all datas of a type in array. Use var_dump() to see what it has <img src='http://zenverse.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Valid values:</p>
<ul>
<li>plugin</li>
<li>theme</li>
</ul>
<p><strong>autoformat</strong><br />
(<em>string</em>) By default, all time and number related data will be formatted based on plugin settings. Once disabled, timestamp will be returned for time-related data and unformatted numbers will be returned for number-related data.<br />
Valid values:</p>
<ul>
<li>true &#8211; default</li>
<li>false (false)</li>
<li>0 (false)</li>
</ul>
<h5>Example of Usage</h5>
<p><strong>Assign all plugins data into a 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('p697code32'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p69732"><td class="code" id="p697code32"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$stored</span> <span style="color: #339933;">=</span> wpeds_return_data_as_array<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'gettype=plugin'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/var_dump"><span style="color: #990000;">var_dump</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$stored</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//to see what's inside</span></pre></td></tr></table></div>

<p><strong>Assign all themes data into a 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('p697code33'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p69733"><td class="code" id="p697code33"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$stored</span> <span style="color: #339933;">=</span> wpeds_return_data_as_array<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'gettype=theme'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/var_dump"><span style="color: #990000;">var_dump</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$stored</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//to see what's inside</span></pre></td></tr></table></div>

<p><strong>Assign a single plugin&#8217;s data into a 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('p697code34'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p69734"><td class="code" id="p697code34"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$stored</span> <span style="color: #339933;">=</span> wpeds_return_data_as_array<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url=http://wordpress.org/extend/plugins/wordpress-extend-download-stat/stats/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/var_dump"><span style="color: #990000;">var_dump</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$stored</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//to see what's inside</span></pre></td></tr></table></div>

<p><strong>Disable auto-formatting all date and number</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('p697code35'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p69735"><td class="code" id="p697code35"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$stored</span> <span style="color: #339933;">=</span> wpeds_return_data_as_array<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'gettype=theme&amp;autoformat=0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/var_dump"><span style="color: #990000;">var_dump</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$stored</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//to see what's inside</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('p697code36'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p69736"><td class="code" id="p697code36"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$stored</span> <span style="color: #339933;">=</span> wpeds_return_data_as_array<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;">'gettype'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'theme'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'autoformat'</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>
<a href="http://www.php.net/var_dump"><span style="color: #990000;">var_dump</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$stored</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//to see what's inside</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/using-template-tag-function-in-wordpress-extend-download-stat-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What A Basic Wordpress Theme Design Should Have</title>
		<link>http://zenverse.net/what-a-basic-wordpress-theme-design-should-have/</link>
		<comments>http://zenverse.net/what-a-basic-wordpress-theme-design-should-have/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 04:25:51 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[make your own wordpres theme]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=460</guid>
		<description><![CDATA[This is part of <a target="_blank" href="http://zenverse.net/the-complete-guide-to-make-your-own-wordpress-theme/">The Complete Guide to Make your Own Wordpress Theme</a>.
A basic wordpress theme should have a header, navigation menu, content, sidebar and footer. This is illustrated in the image..]]></description>
			<content:encoded><![CDATA[<blockquote><p>This is a part of <a target="_blank" href="http://zenverse.net/the-complete-guide-to-make-your-own-wordpress-theme/">The Complete Guide to Make your Own Wordpress Theme</a></p></blockquote>
<h3>Introduction</h3>
<p>A basic wordpress theme should have a header, navigation menu, content, sidebar and footer. This is illustrated in the image below:</p>
<p><img src="http://zenverse.net/wp-content/uploads/2009/07/basicwptheme_shouldhave.gif" alt="What a basic wordpress theme should have" /></p>
<h4>Header</h4>
<p>Here lies your logo and usually, page or category navigation menu, and search box. It is also a common practive that google ads were placed here, so leave some space in the design to fit in the ads.</p>
<h4>Content</h4>
<p>You should make 2 seperate design for the content area: </p>
<ul>
<li>Latest posts at blog index. For each post, you can show its category, date posted, comment count and author name.</li>
<li>Single post page with comments area (when you clicked into a post)</li>
</ul>
<h4>Sidebar</h4>
<p>A sidebar should display important resources like category, recent posts, recent comment, blog roll and more. Some themes also put a search box at sidebar.</p>
<h4>Footer</h4>
<p>Here lies the copyright (eg: &copy; 2009 zenverse , Powered by Wordpress) and link back to theme author.</p>
<h3>Be creative</h3>
<p>Of course, you do not have to follow this old style. What we have discussed above is a very basic &#038; plain theme. You can be creative, change their position, add more features and make your theme special. We will discuss the features you can add to your theme later.</p>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/what-a-basic-wordpress-theme-design-should-have/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Complete Guide to Make your Own Wordpress Theme</title>
		<link>http://zenverse.net/the-complete-guide-to-make-your-own-wordpress-theme/</link>
		<comments>http://zenverse.net/the-complete-guide-to-make-your-own-wordpress-theme/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 10:59:51 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[make your own wordpres theme]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=446</guid>
		<description><![CDATA[I am going to write a complete guide to create your very own wordpress theme along with features or functions you would need to improve the theme. I've divided the guide into several parts...]]></description>
			<content:encoded><![CDATA[<h3>Introduction</h3>
<p>I am going to write a complete guide to create your very own wordpress theme along with features or functions you would need to improve the theme.</p>
<p>I&#8217;ve divided the guide into several parts. Currently it looks like this:</p>
<blockquote>
<ul style="list-style:decimal">
<li><a href="http://zenverse.net/what-a-basic-wordpress-theme-design-should-have/">What A Wordpress Theme Design Should Have</a></li>
<li>Coding Your Wordpress Theme From PSD to XHTML</li>
<li>Basic Wordpress Theme DIY : Introduction &#038; Making of header.php</li>
<li>Basic Wordpress Theme DIY : Making of index.php</li>
<li>Basic Wordpress Theme DIY : Making of sidebar.php</li>
<li>Basic Wordpress Theme DIY : Making of page.php and single.php</li>
<li>Basic Wordpress Theme DIY : Making of comments.php</li>
<li>Basic Wordpress Theme DIY : Making of footer.php</li>
<li>Basic Wordpress Theme DIY : Making of search.php</li>
<li>Basic Wordpress Theme DIY : Making of category.php</li>
<li>Basic Wordpress Theme DIY : Making of archives.php &#038; 404.php</li>
<li><a href="http://zenverse.net/creating-dynamic-sidebars-in-wordpress/">Advanced Wordpress Theme DIY : Widget-Ready Theme &#8211; Dynamic Sidebars</a></li>
<li>Advanced Wordpress Theme DIY : Theme Options Page</li>
<li>Advanced Wordpress Theme DIY : Adding Post Thumbnail to Blog Post</li>
<li>Advanced Wordpress Theme DIY : Adding Related Posts and Popular Posts</li>
<li>Advanced Wordpress Theme DIY : Twitter, Flickr , Feedburner and Google Adsense Integration</li>
<li><a href="http://zenverse.net/create-a-fancy-search-box-using-css/">Extra : Create a Fancy Search Box using CSS</a></li>
</ul>
</blockquote>
<p><strong>I have completed 3 out of 17.</strong></p>
<p>I will start working on the guide when I am free.</p>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/the-complete-guide-to-make-your-own-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix get_categories() Problem in Wordpress 2.8</title>
		<link>http://zenverse.net/fix-get_categories-problem-in-wordpress-2-8/</link>
		<comments>http://zenverse.net/fix-get_categories-problem-in-wordpress-2-8/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 06:21:52 +0000</pubDate>
		<dc:creator>zen</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[get_categories]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[wordpress 2.8]]></category>

		<guid isPermaLink="false">http://zenverse.net/?p=182</guid>
		<description><![CDATA[I have been using get_categories() to display the featured categories in my theme option page. However, the function does not seems to work anymore after I've upgraded to Wordpress 2.8.

Now, I am pretty sure Wordpress 2.8.1 will be released very soon.]]></description>
			<content:encoded><![CDATA[<p>I have been using <em>get_categories()</em> to display the featured categories in my theme option page. However, the function does not seems to work anymore after I&#8217;ve upgraded to Wordpress 2.8 (It returns an array of error like below).</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('p182code37'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p18237"><td class="code" id="p182code37"><pre class="html" style="font-family:monospace;">array(2) { [&quot;errors&quot;]=&gt; array(1) { [&quot;invalid_taxonomy&quot;]=&gt; array(1) { [0]=&gt; string(16) &quot;Invalid Taxonomy&quot; } } [&quot;error_data&quot;]=&gt; array(0) { } }</pre></td></tr></table></div>

<p><strong>Now, I am pretty sure Wordpress 2.8.1 will be released very soon.</strong></p>
<blockquote><p>UPDATE : <a href="http://zenverse.net/wordpress-2-8-1-is-available-upgrade-now/">Wordpress 2.8.1 is already available</a>, please upgrade now.</p></blockquote>
<h3>How to fix it?</h3>
<p>- &#8211; - This temporary solution was removed because WP 2.8.1 is available now &#8211; - -</p>
<p><!--Here's a quote from Wordpress Support :--></p>
<p><!--blockquote>The latest 2.8.1 nightly build has a fix for this if anyone wants to try it out:</p>
<p><a target="_blank" href="http://wordpress.org/nightly-builds/wordpress-2.8-latest.zip">http://wordpress.org/nightly-builds/wordpress-2.8-latest.zip</a></p>
<p>You can do an automatic upgrade by going into wp-includes/version.php and changing $wp_version from 2.8 to 2.8.1-beta and then visiting Tools->Upgrade.</blockquote-->
<h3>Side Notes</h3>
<p>If you are using <em>get_categories()</em> to display category links in sidebar, you should really use <a target="_blank" href="http://codex.wordpress.org/Template_Tags/wp_list_categories">wp_list_categories() </a>instead.</p>
<p>Thank you for reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://zenverse.net/fix-get_categories-problem-in-wordpress-2-8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
