<?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>The WordPress Guru &#187; Advanced</title>
	<atom:link href="http://wpguru.co.za/category/advanced/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpguru.co.za</link>
	<description>Tips &#38; Pointers on Making a Killer CMS with WordPress</description>
	<lastBuildDate>Mon, 01 Aug 2011 10:26:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Force a file to download</title>
		<link>http://wpguru.co.za/templates/page/force-a-file-to-download/</link>
		<comments>http://wpguru.co.za/templates/page/force-a-file-to-download/#comments</comments>
		<pubDate>Tue, 04 May 2010 08:42:54 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Advanced]]></category>
		<category><![CDATA[Page]]></category>
		<category><![CDATA[Single]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=168</guid>
		<description><![CDATA[In building CMS sites for clients, some may require that you offer certain files to be downloaded off their site. A PDF for example, or perhaps wallpapers or other media. Most browsers, correctly, will display these items inline as a new page or tab however for these purposes you need to force the browser to [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_169" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-169" title="download" src="http://wpguru.co.za/wp-content/uploads/download-300x199.jpg" alt="" width="300" height="199" /><p class="wp-caption-text">Image by: vizzzual-dot-com</p></div>
<p>In building CMS sites for clients, some may require that you offer certain files to be downloaded off their site. A PDF for example, or perhaps wallpapers or other media. Most browsers, correctly, will display these items inline as a new page or tab however for these purposes you need to force the browser to download the item, not display it. Here&#8217;s how it&#8217;s done.</p>
<h3>The Code</h3>
<p>Your .htaccess file is the key to getting this done, and here&#8217;s the code you need to add:</p>
<pre class="brush: xml; title: ; notranslate">AddType application/octet-stream .csv
AddType application/octet-stream .xls
AddType application/octet-stream .doc
AddType application/octet-stream .avi
AddType application/octet-stream .mpg
AddType application/octet-stream .mov
AddType application/octet-stream .pdf</pre>
<p>You can of course add as many other filetypes to this list as you may require, but you can get the principle from this example.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/templates/page/force-a-file-to-download/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Display recent Tweets in your WordPress site</title>
		<link>http://wpguru.co.za/featured/display-recent-tweets-in-your-wordpress-site/</link>
		<comments>http://wpguru.co.za/featured/display-recent-tweets-in-your-wordpress-site/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 14:09:48 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=133</guid>
		<description><![CDATA[More and more corporate sites are using Twitter these days and so you&#8217;re more likely to have a client who requires some sort of Twitter activity to be shown in his site. Perhaps he wants his most recent tweet displayed, or a few results from a Twitter search feed. There are a number of Twitter [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_134" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-134" title="Twitter" src="http://wpguru.co.za/wp-content/uploads/twitter-300x244.jpg" alt="" width="300" height="244" /><p class="wp-caption-text">Image by Luc Latulippe</p></div>
<p>More and more corporate sites are using Twitter these days and so you&#8217;re more likely to have a client who requires some sort of Twitter activity to be shown in his site. Perhaps he wants his most recent tweet displayed, or a few results from a Twitter search feed.</p>
<p>There are a number of Twitter based widgets and plugins, but in most cases, they&#8217;re heavily styled and don&#8217;t make it very easy for you to integrate a tweet or two into a very specific area in your design. The script below let&#8217;s you do just that and so it&#8217;s my method of choice.</p>
<p>Here&#8217;s a great and flexible script to grab some recent tweets for your WordPress site:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
$doc = new DOMDocument();

# load the RSS -- replace 'lylo' with your user of choice
if($doc-&gt;load('http://twitter.com/statuses/user_timeline/INSERT_USERNAME_HERE.rss')) {
 echo &quot;&lt;ul&gt;\n&quot;;

 # number of &lt;li&gt; elements to display.  20 is the maximum
 $max_tweets = 10;

 $i = 1;
 foreach ($doc-&gt;getElementsByTagName('item') as $node) {
 # fetch the title from the RSS feed.
 # Note: 'pubDate' and 'link' are also useful (I use them in the sidebar of this blog)
 $tweet = $node-&gt;getElementsByTagName('title')-&gt;item(0)-&gt;nodeValue;

 # the title of each tweet starts with &quot;username: &quot; which I want to remove
 $tweet = substr($tweet, stripos($tweet, ':') + 1);

 # OPTIONAL: turn URLs into links
 $tweet = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@',
 '&lt;a href=&quot;$1&quot;&gt;$1&lt;/a&gt;', $tweet);

 # OPTIONAL: turn @replies into links
 $tweet = preg_replace(&quot;/@([0-9a-zA-Z]+)/&quot;,
 &quot;&lt;a href=\&quot;http://twitter.com/$1\&quot;&gt;@$1&lt;/a&gt;&quot;,
 $tweet);

 echo &quot;&lt;li&gt;&quot;. $tweet  . &quot;&lt;/li&gt;\n&quot;;

 if($i++ &gt;= $max_tweets) break;
 }
 echo &quot;&lt;/ul&gt;\n&quot;;
}
?&gt;</pre>
<p>Remember that if your working of a busy site, it&#8217;s probably a good idea to integrate this with a caching system to avoid any problems with the Twitter API limits.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/featured/display-recent-tweets-in-your-wordpress-site/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Easy WordPress Breadcrumbs</title>
		<link>http://wpguru.co.za/navigation/easy-wordpress-breadcrumbs/</link>
		<comments>http://wpguru.co.za/navigation/easy-wordpress-breadcrumbs/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 13:22:40 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[breadcrumb]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=121</guid>
		<description><![CDATA[Your site should always be as usable as possible and site navigation is a big part of that. Aside from your standard sidebars and top navigation, it's always a good idea to include a breadcrumb to let users track their way back to the home page.]]></description>
			<content:encoded><![CDATA[<div id="attachment_127" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-127" title="WordPress Breadcrumbs" src="http://wpguru.co.za/wp-content/uploads/breadcrumb-300x288.jpg" alt="" width="300" height="288" /><p class="wp-caption-text">Image by PetitPlat by sk_</p></div>
<p>Your site should always be as usable as possible and site navigation is a big part of that. Aside from your standard sidebars and top navigation, it&#8217;s always a good idea to include a breadcrumb to let users track their way back to the home page. Of course there are lots of plugins you can use to insert this, but why use a plugin, when you can do it just as easily on your own.</p>
<p>Here&#8217;s the code that you&#8217;ll need to add to your functions.php file:</p>
<pre class="brush: php; title: ; notranslate">//breadcrumb function
function YLcrumbs() {
 if ((is_page() &amp;&amp; !is_front_page()) || is_home() || is_category() || is_single()) {
 echo '&lt;ul id=&quot;breadcrumbs&quot;&gt;';
 echo '&lt;li&gt;&lt;a href=&quot;'.get_bloginfo('url').'&quot;&gt;Home&lt;/a&gt;&amp;raquo;&lt;/li&gt;';
 $post_ancestors = get_post_ancestors($post);
 if ($post_ancestors) {
 $post_ancestors = array_reverse($post_ancestors);
 foreach ($post_ancestors as $crumb)
 echo '&lt;li&gt;&lt;a href=&quot;'.get_permalink($crumb).'&quot;&gt;'.get_the_title($crumb).'&lt;/a&gt;&amp;raquo;&lt;/li&gt;';
 }
 if (is_category() || is_single()) {
 $category = get_the_category();
 echo '&lt;li&gt;&lt;a href=&quot;'.get_category_link($category[0]-&gt;cat_ID).'&quot;&gt;'.$category[0]-&gt;cat_name.'&lt;/a&gt;&amp;raquo;&lt;/li&gt;';
 }
 if (!is_category())
 echo '&lt;li&gt;&lt;a href=&quot;'.get_permalink().'&quot;&gt;'.get_the_title().'&lt;/a&gt;&lt;/li&gt;';
 echo '&lt;/ul&gt;';
 }
}</pre>
<p>Then, in your template, wherever you want to display your breadcrumb, you&#8217;d add the following:</p>
<pre class="brush: php; title: ; notranslate">&lt;? YLcrumbs(); ?&gt;</pre>
<p>Note that the function generates a breadcrumb in a UL element, so your CSS might look something like this:</p>
<pre class="brush: css; title: ; notranslate">#breadcrumbs {padding: 10px 0;margin:0;}
#breadcrumbs li {display:inline;padding: 0 10px 0 0;}</pre>
<p>That would give you a  list of LI elements in a row. Then you can style it up further as you require.</p>
<p>Have you used this somewhere? Leave a link in the comments to your implementation of this breadcrumb system.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/navigation/easy-wordpress-breadcrumbs/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Automatically add Google Analytics to your footer</title>
		<link>http://wpguru.co.za/featured/automatically-add-google-analytics-to-your-footer/</link>
		<comments>http://wpguru.co.za/featured/automatically-add-google-analytics-to-your-footer/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 13:09:47 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=118</guid>
		<description><![CDATA[It should be noted that using Google's Asynchronous Analytics code (triggers analytics reporting via javascript) is a much preferred option because it does its reporting in the background without hampering page load speeds. If however you need to use the standard method of inserting Google Analtyics, then here's a quick tip to insert the analytics code into your site's footer:]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-119" title="google" src="http://wpguru.co.za/wp-content/uploads/google-300x211.jpg" alt="" width="300" height="211" />It should be noted that using Google&#8217;s Asynchronous Analytics code (triggers analytics reporting via javascript) is a much preferred option because it does its reporting in the background without hampering page load speeds. If however you need to use the standard method of inserting Google Analtyics, then here&#8217;s a quick tip to insert the analytics code into your site&#8217;s footer:</p>
<pre class="brush: php; title: ; notranslate">// add google analytics to footer
function add_google_analytics() {
 echo '&lt;script src=&quot;http://www.google-analytics.com/ga.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;';
 echo '&lt;script type=&quot;text/javascript&quot;&gt;';
 echo 'var pageTracker = _gat._getTracker(&quot;UA-XXXXX-X&quot;);';
 echo 'pageTracker._trackPageview();';
 echo '&lt;/script&gt;';
}
add_action('wp_footer', 'add_google_analytics');</pre>
<p>Remember to change UA-XXXXX-X to your own analytics ID.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/featured/automatically-add-google-analytics-to-your-footer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to reset your WP Password in PHPMyAdmin</title>
		<link>http://wpguru.co.za/advanced/database/how-to-reset-your-wp-password-in-phpmyadmin/</link>
		<comments>http://wpguru.co.za/advanced/database/how-to-reset-your-wp-password-in-phpmyadmin/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 07:21:41 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[phpmyadmin]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=68</guid>
		<description><![CDATA[I am using XAMPP to run a local version of WP on my machine for theme testing etc. I haven't installed the PHP mail() function because its not a feature I regularly use. This presented a problem when I misplaced my login details for my local WP install and couldn't run the 'Lost Password' feature. However I found a way to reset my WordPress password using a neat website and PHPMyAdmin. Here's how.]]></description>
			<content:encoded><![CDATA[<p>I am using <a href="http://www.apachefriends.org/en/xampp.html">XAMPP</a> to run a local version of WP on my machine for theme testing etc. I haven&#8217;t installed the PHP <code>mail()</code> function because its not a feature I regularly use. This presented a problem when I misplaced my login details for my local WP install and couldn&#8217;t run the &#8216;Lost Password&#8217; feature. However I found a way to reset my WordPress password using a neat website and PHPMyAdmin. Here&#8217;s how.</p>
<p>Firstly, I logged into PHPMyAdmin and browsed the users table. I edited the entry for my &#8216;<code>admin</code>&#8216; account and found the &#8216;<code>user_pass</code>&#8216; field.</p>
<p>This field will by default have an encrypted version of your password, something like <code>$P$BERsVRczS226JkUY29j72YuVSzm3yP/</code> .</p>
<p>Instead of trying to decrypt this, I just generated a new MD5 password and pasted the encrypted version in this field.</p>
<p>I encrypted a new password using the <a href="http://www.iwebtool.com/md5">iWebTool</a> website. Type in the password you&#8217;d like to have, and then click &#8216;Encrypt&#8217;. That then generates your MD5 password. For example I typed in &#8216;<code>wpguru</code>&#8216; as my password and that generated &#8216;<code>f1c061320553d089aa807e975e2a936f</code>&#8216;.</p>
<p><img class="alignnone size-full wp-image-69" title="iwebtool" src="http://wpguru.co.za/wp-content/uploads/iwebtool.jpg" alt="" width="495" height="146" /></p>
<p>All you need to do then is paste that encrytped password into the WP database field and presto, your lost password problem is fixed.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/advanced/database/how-to-reset-your-wp-password-in-phpmyadmin/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Own your WordPress loop with wp_query</title>
		<link>http://wpguru.co.za/advanced/the-loop/own-your-wordpress-loop-with-wp_query/</link>
		<comments>http://wpguru.co.za/advanced/the-loop/own-your-wordpress-loop-with-wp_query/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 09:42:37 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[The Loop]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[wp query]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=38</guid>
		<description><![CDATA[The WordPress loop is arguably the heart of any WP powered site. With all this power at its fingertips, it obviously has some serious customization potential. I'm going to explain a couple of ways here of how you can fully use the potential of your WP CMS's loop to display custom content anywhere on your site. Get ready to own your WP Loop!]]></description>
			<content:encoded><![CDATA[<div id="attachment_139" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-139 " title="WordPress Loop" src="http://wpguru.co.za/wp-content/uploads/loop-300x200.jpg" alt="" width="300" height="200" /><p class="wp-caption-text">Image by yaz36</p></div>
<p>The WordPress loop is arguably the heart of any WP powered site. With all this power at its fingertips, it obviously has some serious customization potential. I&#8217;m going to explain a couple of ways here of how you can fully use the potential of your WP CMS&#8217;s loop to display custom content anywhere on your site. Get ready to <a href="http://www.urbandictionary.com/define.php?term=own" target="_blank">own</a> your WP Loop!</p>
<h3>The Scenario</h3>
<p>Remembering that content is king, I always recommend to my clients that they have a blog of some sort: a style blog, <a href="http://www.pokerblog.com/">Pokerblog</a>, Tech blog &#8211; whatever it is they do, they need a blog. Thus somewhere in your custom WP theme, you&#8217;re going to want to display maybe the latest 2 or 3 articles from their blog. Usually, you could just use <code>query_posts()</code> to bring in posts from a specific category.</p>
<p>However, I&#8217;ve found in the past that if I use this method before the normal loop for the page&#8217;s content, it messes with the functionality of the main loop because of issues with <code>rewind_posts()</code> and such.</p>
<p>To altogether avoid this issue, it&#8217;ll be best if you get used to making your own WP query.</p>
<h3>Making your loop</h3>
<p>Before looping, you need to tell WordPress what to loop through. So firstly, setup your query.</p>
<pre class="brush: php; title: ; notranslate">&lt;?
 $recentPosts = new WP_Query();
 $recentPosts-&gt;query('showposts=5');
?&gt;</pre>
<p>Then you can join it up with a loop to process the information that your query finds.</p>
<pre class="brush: php; title: ; notranslate">&lt;? while ($recentPosts-&gt;have_posts()) : $recentPosts-&gt;the_post(); ?&gt;
&lt;!-- LOOP STUFF HERE --&gt;
&lt;?php endwhile; ?&gt;</pre>
<p>So when you add it all together:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
 $recentPosts = new WP_Query();
 $recentPosts-&gt;query('showposts=5');
 while ($recentPosts-&gt;have_posts()) : $recentPosts-&gt;the_post();
?&gt;
&lt;!-- LOOP STUFF HERE --&gt;
&lt;?php endwhile; ?&gt;</pre>
<p>The query itself can have <a href="http://codex.wordpress.org/Template_Tags/query_posts" target="_blank">many different arguments</a> to help you filter down to exactly what you&#8217;re looking for. For example:</p>
<ul>
<li><code>cat=3</code> &#8211; specify the category that you want to display. If you have more posts that you want to include than exclude, then it might be easier to just filter out the ones you don&#8217;t want to see by using: <code>cat=-1, -2, -3</code> etc</li>
<li><code>showposts=3</code> &#8211; specify how many posts you want to show</li>
<li><code>orderby=name</code> &#8211; determine how you want your results to be ordered by: author, date, category, id, title, modified, parent and rand. orderby=rand is a great means of having a news area that displays a random news article from the archives.</li>
<li><code>year=2004</code> &#8211; display posts from only a specific year</li>
</ul>
<p>You can string a whole bunch of these arguments together like so:</p>
<pre class="brush: php; title: ; notranslate">&lt;? query_posts('cat=3,4,5&amp;showposts=10&amp;orderby=date'); ?&gt;</pre>
<p>With a little imagination, your query can retrieve any number of configurable results.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/advanced/the-loop/own-your-wordpress-loop-with-wp_query/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>
