<?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>Blue Anvil Journal &#187; functions</title>
	<atom:link href="http://blue-anvil.com/tag/functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://blue-anvil.com</link>
	<description>The online blogfolio of Mike Jolley</description>
	<lastBuildDate>Sun, 05 Sep 2010 14:39:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPress Snippet #1: &#8220;nofollow&#8221; your blogroll</title>
		<link>http://blue-anvil.com/archives/wordpress-snippet-1-nofollow-your-blogroll/</link>
		<comments>http://blue-anvil.com/archives/wordpress-snippet-1-nofollow-your-blogroll/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 15:37:17 +0000</pubDate>
		<dc:creator>Mike Jolley</dc:creator>
				<category><![CDATA[Wordpress & plugins]]></category>
		<category><![CDATA[Blogroll]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[nofollow]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blue-anvil.com/?p=623</guid>
		<description><![CDATA[The Wordress Snippets series of posts will give you some useful code snippets for use in your projects &#8211; just copy and paste (but try to understand how they work!). This snippet will add rel="nofollow" to the links in your blogroll, or those outputted by wp_list_bookmarks. Add to functions.php or your links template. 1 2 [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-628" title="snippet" src="http://blue-anvil.com/wp-content/uploads/2009/08/snippet.png" alt="snippet" width="488" height="100" /></p>
<p><em>The Wordress Snippets series of posts will give you some useful code snippets for use in your projects &#8211; just copy and paste (but try to understand how they work!).</em></p>
<p>This snippet will add <code>rel="nofollow"</code> to the links in your blogroll, or those outputted by <code>wp_list_bookmarks</code>. Add to <code>functions.php</code> or your <code>links template</code>.</p>
<p><span id="more-623"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> nofollow_my_bookmarks<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$links</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$links</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$link</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$link</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link_rel</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">' nofollow'</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$link</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link_rel</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$link</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link_rel</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$links</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_bookmarks'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'nofollow_my_bookmarks'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>How it works</strong></p>
<p>WordPress uses a function called <code>get_bookmarks</code> when it gets links for your blogroll &#8211; we use a filter to hook in and add the &#8216;nofollow&#8217; rel tag.</p>
<img src="http://blue-anvil.com/7dc46085/266bbf6b/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></content:encoded>
			<wfw:commentRss>http://blue-anvil.com/archives/wordpress-snippet-1-nofollow-your-blogroll/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
