<?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>ElegantWebDesigns &#124; Photographers &#38; Artists WordPress Themes, Web Design, PSD Album Templates &#187; Plugins</title>
	<atom:link href="http://www.elegantwebdesigns.net/category/plugins/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.elegantwebdesigns.net</link>
	<description>Your one stop for all your online presence needs. Specialized in Photographers &#38; Artists Websites. Word Press templates, Custom Web Designs, E-Commerce Websites.</description>
	<lastBuildDate>Wed, 11 Jan 2012 14:49:08 +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>Show ONLY WP Recent Published Posts</title>
		<link>http://www.elegantwebdesigns.net/2010/06/show-only-wp-recent-published-posts/</link>
		<comments>http://www.elegantwebdesigns.net/2010/06/show-only-wp-recent-published-posts/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 14:01:57 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WP Tips & Tricks]]></category>
		<category><![CDATA[recent posts]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.elegantwebdesigns.net/?p=263</guid>
		<description><![CDATA[One of the key features of  WordPress is the ability to do basically anything with it. By just adding a little piece of code to the functions.php, to any of the pages, sidebar or to both many things can be achieved. Lately adding a list of recent posts to a blog has become quite popular and [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-268" style="margin-left: 10px; margin-right: 10px;" title="WP Recent Posts" src="http://www.elegantwebdesigns.net/wp-content/uploads/2010/06/recentposts.jpg" alt="WP Recent Posts" width="150" height="150" />One of the key features of  WordPress is the ability to do basically anything with it. By just adding a little piece of code to the <em>functions.php, </em>to any of the pages, sidebar or to both many things can be achieved. Lately adding a list of recent posts to a blog has become quite popular and this can be done with just a few pieces of code.</p>
<p>As explained in the Codex, the first thing you need to do is add this piece of code to where you want your recent posts to appear. In this example we&#8217;re going to place it in the <em>sidebar.php</em> but you can place it basically anywhere.</p>
<blockquote><p>&lt;?php wp_get_recent_posts( $num ) ?&gt;</p></blockquote>
<p>By default <span style="color: #888888;"><em>$num</em></span> will pull the 10 most recent posts, but you can add any number you want. Now this piece of code is quite simple and not necessarily too efficient, so you might want to dress it a little bit more like in the example below, so each title becomes a link to the actual post.</p>
<blockquote>
<div id="_mcePaste">&lt;h4&gt;Recent Posts&lt;/h4&gt;</div>
<div id="_mcePaste">&lt;ul&gt;</div>
<div id="_mcePaste">&lt;?php $recent_posts = wp_get_recent_posts(5); //Shows 5 most recent posts</div>
<div id="_mcePaste">foreach($recent_posts as $post){</div>
<div id="_mcePaste">echo &#8216;&lt;li&gt;&lt;a href=&#8221;&#8216; . get_permalink($post["ID"]) . &#8216;&#8221; title=&#8221;Look &#8216;.$post["post_title"].&#8217;&#8221; &gt;&#8217; .   $post["post_title"].&#8217;&lt;/a&gt; &lt;/li&gt; &#8216;;</div>
<div id="_mcePaste">} ?&gt;</div>
<div id="_mcePaste">&lt;/ul&gt;</div>
</blockquote>
<p>By running this code you will get the 5 most recent posts but that will include the private ones, drafts and even the published ones, which is not exactly what you want. Last thing anyone wants is to show a lists of drafts and private posts as by default these won&#8217;t render, so the solution is very simple.</p>
<blockquote><p>Locate and open the <em><span style="color: #888888;">wp-includes/post.php</span></em> file. At around line 2039 you will find this piece of code:<br />
/**<br />
* Retrieve number of recent posts.<br />
*<br />
* @since 1.0.0<br />
* @uses $wpdb<br />
*<br />
* @param int $num Optional, default is 10. Number of posts to get.<br />
* @return array List of posts.<br />
*/<br />
function wp_get_recent_posts($num = 10) {<br />
global $wpdb;<br />
// Set the limit clause, if we got a limit<br />
$num = (int) $num;<br />
if ( $num ) {<br />
$limit = &#8220;LIMIT $num&#8221;;<br />
}<br />
$sql = &#8220;SELECT * FROM $wpdb-&gt;posts WHERE post_type = &#8216;post&#8217; AND post_status IN (&#8216;<span style="color: #ff0000;">draft</span>&#8216;, &#8216;publish&#8217;, &#8216;<span style="color: #ff0000;">future</span>&#8216;, &#8216;<span style="color: #ff0000;">pending</span>&#8216;, &#8216;<span style="color: #ff0000;">private</span>&#8216; ) ORDER BY post_date DESC $limit&#8221;;<br />
$result = $wpdb-&gt;get_results($sql, ARRAY_A);<br />
return $result ? $result : array();<br />
}</p></blockquote>
<p>From it remove draft, future, pending and private leaving only publish, so the piece of code will look like this:</p>
<blockquote><p>/**<br />
* Retrieve number of recent posts.<br />
*<br />
* @since 1.0.0<br />
* @uses $wpdb<br />
*<br />
* @param int $num Optional, default is 10. Number of posts to get.<br />
* @return array List of posts.<br />
*/<br />
function wp_get_recent_posts($num = 10) {<br />
global $wpdb;<br />
// Set the limit clause, if we got a limit<br />
$num = (int) $num;<br />
if ( $num ) {<br />
$limit = &#8220;LIMIT $num&#8221;;<br />
}<br />
$sql = &#8220;SELECT * FROM $wpdb-&gt;posts WHERE post_type = &#8216;post&#8217; AND post_status IN (&#8221;, &#8216;<span style="color: #ff0000;">publish</span>&#8216;, &#8221;, &#8221;, &#8221; ) ORDER BY post_date DESC $limit&#8221;;<br />
$result = $wpdb-&gt;get_results($sql, ARRAY_A);<br />
return $result ? $result : array();<br />
}</p></blockquote>
<p>Save and upload the file again if using FTP or simply save if using the built in WP editor. Now only the published posts will appear when using the <em><span style="color: #999999;">wp_get_recent_posts</span></em> function.</p>
<p>UPDATE 1/11/2012:  As expressed by the many comments below, modifying the core files can be time consuming. Keeping up with the hundreds of updates these files go through every time a new version of WordPress comes out is a task on its own. Instead include the change only on the sidebar in this manner:</p>
<blockquote><p>/**<br />
* Retrieve number of recent posts.<br />
*/</p>
<div id="_mcePaste">&lt;h4&gt;Recent Posts&lt;/h4&gt;</div>
<div id="_mcePaste">&lt;ul&gt;</div>
<div id="_mcePaste">&lt;?php<br />
$args = array( &#8216;numberposts&#8217; =&gt; &#8217;5&#8242;, &#8216;post_status&#8217; =&gt; &#8216;publish&#8217; ); //Shows 5 most published posts only<br />
$recent_posts = wp_get_recent_posts( $args );<br />
foreach( $recent_posts as $recent ){<br />
echo &#8216;&lt;li&gt;&lt;a href=&#8221;&#8216; . get_permalink($recent["ID"]) . &#8216;&#8221; title=&#8221;Look &#8216;.$recent["post_title"].&#8217;&#8221; &gt;&#8217; . $recent["post_title"].&#8217;&lt;/a&gt; &lt;/li&gt; &#8216;;<br />
} ?&gt;<br />
&lt;/ul&gt;</div>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.elegantwebdesigns.net/2010/06/show-only-wp-recent-published-posts/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>WordPress Database Optimization</title>
		<link>http://www.elegantwebdesigns.net/2010/05/wordpress-database-optimization/</link>
		<comments>http://www.elegantwebdesigns.net/2010/05/wordpress-database-optimization/#comments</comments>
		<pubDate>Sun, 09 May 2010 15:07:35 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress optimization]]></category>

		<guid isPermaLink="false">http://www.elegantwebdesigns.net/?p=225</guid>
		<description><![CDATA[One of the biggest problems of WordPress is the lack of built-in database optimization and clean up. And although there are a few plugins in the WordPress Plugin Directory, one that we really like is WP-Optimize by Ruhani Rabin. The plugin is easy to install by even the beginners wordpress user and in just a [...]]]></description>
			<content:encoded><![CDATA[<p><img class="left size-full wp-image-230 alignleft" style="margin-left: 10px; margin-right: 10px;" title="WP-Optimize - WordPress Database Optimization Tool" src="http://www.elegantwebdesigns.net/wp-content/uploads/2010/05/wp-optimize.jpg" alt="WP-Optimize - WordPress Database Optimization Tool" width="150" height="150" />One of the biggest problems of WordPress is the lack of built-in database optimization and clean up. And although there are a few plugins in the WordPress Plugin Directory, one that we really like is <a href="http://wordpress.org/extend/plugins/wp-optimize/" target="_blank">WP-Optimize</a> by Ruhani Rabin.</p>
<p>The plugin is easy to install by even the beginners wordpress user and in just a few selections and clicks it accomplishes the task of cleaning your database directly from your wordpress admin area without the need to go to PHPmyAdmin.<br />
<strong><span style="color: #008080;">Features</span></strong></p>
<hr />
<ol>
<li> Remove the wordpress post revisions</li>
<li> Remove all the comments in the spam queue</li>
<li> Remove all the un-approved comments</li>
<li> Rename one username to another username, it&#8217;s designed to rename default &#8220;Admin&#8221; user to something else</li>
<li> Apply mysql optimize commands on your database tables without phpMyAdmin.</li>
<li> Display Database table statistics. Shows how much space can be optimzied and how much space has been cleared.</li>
</ol>
<p><strong><span style="color: #008080;">How can this help?</span></strong></p>
<hr />Very simple! by having a smaller, clean and optimized database, your website will run &amp; download much faster. Nothing is more annoying for a user than browsing a website that takes forever to download. 80% of visitors will close a website that is slow, no matter how good your content is. So yes, on the internet faster is better.</p>
<h3><a title="Wordpress Database Optimization" href="http://wordpress.org/extend/plugins/wp-optimize/" target="_blank">Download WP-Optimize &gt;&gt;</a></h3>
]]></content:encoded>
			<wfw:commentRss>http://www.elegantwebdesigns.net/2010/05/wordpress-database-optimization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

