<?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>epicblog &#187; WordPress</title> <atom:link href="http://www.rickwargo.com/category/wordpress/feed/" rel="self" type="application/rss+xml" /><link>http://www.rickwargo.com</link> <description>Acquiring information, one day at a time.</description> <lastBuildDate>Fri, 14 Oct 2011 01:23:12 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Hiding empty content in WordPress</title><link>http://www.rickwargo.com/2006/02/21/hiding-empty-content-in-wordpress/</link> <comments>http://www.rickwargo.com/2006/02/21/hiding-empty-content-in-wordpress/#comments</comments> <pubDate>Tue, 21 Feb 2006 15:07:54 +0000</pubDate> <dc:creator>Rick Wargo</dc:creator> <category><![CDATA[WILT]]></category> <category><![CDATA[WordPress]]></category> <guid
isPermaLink="false">http://blog.rickwargo.com/2006/02/21/hiding-empty-content-in-wordpress/</guid> <description><![CDATA[Turns out that there is a lot of empty sidebar lists (&#60;ul&#62; elements) when there are no blog entries in a newly created WordPress blog. In creating my own theme (epic), I&#8217;ve tried to clean up those sections by checking to see if there are any posts. This turns out to be an easy task [...]]]></description> <content:encoded><![CDATA[<p>Turns out that there is a lot of empty sidebar lists (&lt;ul&gt; elements) when there are no blog entries in a newly created WordPress blog. In creating my own theme (epic), I&#8217;ve tried to clean up those sections by checking to see if there are any posts. This turns out to be an easy task to accomplish.</p><p>The trick is to wrap the HTML in a PHP block that checks to see if any posts exist. This is done by the following PHP code:</p><p><code><br
/> <?php<br
/> global $wpdb;<br
/> $request = "SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_password = '' LIMIT 0, 1";<br
/> $p = $wpdb->get_results($request);<br
/> if (function_exists('mdv_recent_posts') &#038;&#038; (isset($p)) &#038;&#038; (!is_archive() &#038;&#038; !is_category())) {<br
/> ?></p><li><h2>Sidebar List</h2><ul> <?php generate_list_items(); ?></ul></li><p><?php } ?><br
/> </code></p><p>In this example, the sidebar element, <strong>Sidebar List</strong>, will only appear if there is at least one post.</p> ]]></content:encoded> <wfw:commentRss>http://www.rickwargo.com/2006/02/21/hiding-empty-content-in-wordpress/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
