<?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>Skowronek.org &#187; Template</title>
	<atom:link href="http://www.skowronek.org/tag/template/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.skowronek.org</link>
	<description>The official web site for the Skowronek family of South Jordan, Utah, USA</description>
	<lastBuildDate>Sat, 12 Jun 2010 23:21:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Facebook Badge as a WordPress Sidebar Widget</title>
		<link>http://www.skowronek.org/2008/08/22/facebook-badge-as-a-wordpress-sidebar-widget/</link>
		<comments>http://www.skowronek.org/2008/08/22/facebook-badge-as-a-wordpress-sidebar-widget/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 21:54:31 +0000</pubDate>
		<dc:creator>Skowronek</dc:creator>
				<category><![CDATA[Off-Topic]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sidebar]]></category>
		<category><![CDATA[Template]]></category>
		<category><![CDATA[Widget]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.skowronek.org/?p=808</guid>
		<description><![CDATA[I tinker around a lot with WordPress. As a matter of fact, I tinker a lot and am quite good at it. I have created various custom modules (unpublished) as well as written a PHPBB to WordPress migration utility (long lost unfortunately). Lately I have been keen to develop custom sidebar widgets by mashing up [...]]]></description>
			<content:encoded><![CDATA[<p>I tinker around a lot with <a href="http://www.wordpress.org" target="_blank">WordPress</a>. As a matter of fact, I tinker a lot and am quite good at it. I have created various custom modules (unpublished) as well as written a <a href="http://www.phpbb.com" target="_blank">PHPBB</a> to WordPress migration utility (long lost unfortunately). Lately I have been keen to develop custom sidebar widgets by mashing up social site widgets. My latest, the Facebook badge sidebar widget.</p>
<p>This is alpha code and is not intended for those unfamiliar with PHP and/or the WordPress API.</p>
<p>You will also need to be familiar with the <a href="http://automattic.com/code/widgets/api/" target="_blank">WordPress widget API</a>.</p>
<p><span id="more-808"></span></p>
<ol>
<li>Create a <a href="http://www.new.facebook.com/badges.php" target="_blank">Facebook badge</a></li>
<li>Copy the script code they provide following a successful build

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://badge.facebook.com/badge/xxxxxxx.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">noscript</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.new.facebook.com/people/xxxxxx/xxxxxxx&quot;</span>&gt;</span>Facebook profile<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">noscript</span>&gt;</span></pre></div></div>

</li>
<li>Add the following PHP function into your widget.php file with the generated code between the badge tags

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">function widget_facebook($p)
{
?&gt;
&lt;li&gt;
&lt;!-- Facebook Badge --&gt;
&lt;script src=&quot;http://badge.facebook.com/badge/xxxxxxx.js&quot;&gt;&lt;/script&gt;
&lt;noscript&gt;
	&lt;a href=&quot;http://www.new.facebook.com/people/xxxxxx/xxxxxxx&quot;&gt;Facebook profile&lt;/a&gt;
&lt;/noscript&gt;
&lt;!-- /Facebook Badge --&gt;
&lt;/li&gt;
<span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</li>
<li>Register the widget with your sidebar in the function.php script

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">if ( function_exists('register_sidebar_widget') )
{
		register_sidebar_widget(__('Facebook'), 'widget_facebook', '');
}</pre></div></div>

</li>
<li>Make sure you have dynamic sidebar enabled in your sidebar.php script

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sidebar&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;?php</span>
<span style="color: #009900;">	if <span style="color: #66cc66;">&#40;</span>function_exists<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'dynamic_sidebar'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></span>
<span style="color: #009900;">	<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">		dynamic_sidebar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">	<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #009900;">?&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</li>
<li>Finally, update your stylesheet to override the Facebook style settings.

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.fb_root_vert</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">195px</span> !important
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.fb_vert</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">193px</span> !important
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.fb_object</span> table tr td
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">185px</span> !important
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.fb_badge</span> <span style="color: #00AA00;">&gt;</span> a
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span> !important<span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">50px</span> !important<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.fb_badge</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#3B5998</span> !important<span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">8px</span> !important<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</li>
</ol>
<p>Now that you have the code, you can add the widget to your sidebar through the WordPress widget administration screen.</p>
<p>That&#8217;s all. Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skowronek.org/2008/08/22/facebook-badge-as-a-wordpress-sidebar-widget/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
