<?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; snippet</title>
	<atom:link href="http://blue-anvil.com/tag/snippet/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 #2: Style the login page</title>
		<link>http://blue-anvil.com/archives/wordpress-snippet-2-style-the-login-page/</link>
		<comments>http://blue-anvil.com/archives/wordpress-snippet-2-style-the-login-page/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 14:35:34 +0000</pubDate>
		<dc:creator>Mike Jolley</dc:creator>
				<category><![CDATA[Wordpress & plugins]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[examples]]></category>
		<category><![CDATA[login page]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blue-anvil.com/?p=636</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 a stylesheet to your login page so that you can style it fully, and also change the default WordPress logo link [...]]]></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 a stylesheet to your login page so that you can style it fully, and also change the default WordPress logo link (to wordpress.org) and title text to something of your choosing. Add it to <code>functions.php</code> in your template.</p>
<p><span id="more-636"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> custom_loginpage_logo_link<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">// Return a url; in this case the homepage url of wordpress</span>
     <span style="color: #b1b100;">return</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wpurl'</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;">function</span> custom_loginpage_logo_title<span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">// Return title text for the logo to replace 'wordpress'; in this case, the blog name.</span>
     <span style="color: #b1b100;">return</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</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;">function</span> custom_loginpage_head<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">/* Add a stylesheet to the login page; add your styling in here, for example to change the logo use something like:
     #login h1 a {
          background:url(images/logo.jpg) no-repeat top;
     }
     */</span>
     <span style="color: #000088;">$stylesheet_uri</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/css/login.css&quot;</span><span style="color: #339933;">;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;link rel=&quot;stylesheet&quot; href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$stylesheet_uri</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// Hook in</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;login_headerurl&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;custom_loginpage_logo_link&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;login_headertitle&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;custom_loginpage_logo_title&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;login_head&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;custom_loginpage_head&quot;</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>We simply use the wordpress hooks on the login page (<code>custom_loginpage_logo_link</code>, <code>custom_loginpage_logo_title</code>, <code>custom_loginpage_head</code>) to insert our code and modify the existing title text and link to something of our own.</p>
<img src="http://blue-anvil.com/7dc46085/266bbf6d/CCBot/1.0 (+http://www.commoncrawl.org/bot.html).gif" />]]></content:encoded>
			<wfw:commentRss>http://blue-anvil.com/archives/wordpress-snippet-2-style-the-login-page/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<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/266bbf6d/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>
