<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Brolly</title>
	
	<link>http://brolly.ca</link>
	<description>We chat about blogging, social media and answer questions submitted by our readers!</description>
	<pubDate>Thu, 03 Dec 2009 16:19:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/brollyblog" /><feedburner:info uri="brollyblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>brollyblog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Widget to Translate Blog Link Categories with WPML</title>
		<link>http://feedproxy.google.com/~r/brollyblog/~3/yINjhiq9oEk/</link>
		<comments>http://brolly.ca/blog/wordpress/widget-to-translate-blog-link-categories-with-wpml/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 16:14:52 +0000</pubDate>
		<dc:creator>Dan Imbrogno</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://brolly.ca/?p=406</guid>
		<description><![CDATA[I&#8217;ve been using the WPML plugin on a few sites recently to turn Wordpress into a very powerful multilingual CMS, with great success. I really have to applaud these guys for building a very useful plugin. On the to-do list is integrating their plug-in with Wordpress&#8217; built-in widgets. A few people have mentioned getting stuck [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using the WPML plugin on a few sites recently to turn Wordpress into a very powerful multilingual CMS, with great success. I really have to applaud these guys for building a very useful plugin. On the to-do list is integrating their plug-in with Wordpress&#8217; built-in widgets. A few people have mentioned getting stuck when trying to use the Links feature of Wordpress, which does not currently work with WPML.</p>
<p>To fix this issue, I&#8217;ve thrown together a quick widget that acts as a wrapper for Wordpress&#8217; built-in widget, but lets you set a different link category for each language you have setup using WPML. I hope you find this useful.</p>
<p>To install, copy and paste this into your theme&#8217;s function.php file or insert code into a file in the plugins directory.</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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">add_action('widgets_init',  array('LinkTranslationWidget','register_widget'));
&nbsp;
class LinkTranslationWidget extends WP_Widget
{	
&nbsp;
	function LinkTranslationWidget() {
&nbsp;
		/* Widget settings. */
		$widget_ops = array( 'classname' =&gt; 'LinkTranslationWidget', 'description' =&gt; __('This widget allows you to set different link categories to display based on a language setting.', $this-&gt;plugin_name) );
&nbsp;
		/* Widget control settings. */
&nbsp;
		/* Create the widget. */
		$this-&gt;WP_Widget( 'LinkTranslationWidget', __('WPML Links'), $widget_ops );
&nbsp;
	}
&nbsp;
	function register_widget()
	{
		register_widget('LinkTranslationWidget');
	}
&nbsp;
	function widget( $args, $instance ) {
&nbsp;
		global $sitepress;
&nbsp;
		if(class_exists('WP_Widget_Links')) {
&nbsp;
			$link_widget = new WP_Widget_Links();			
&nbsp;
			if(isset($sitepress))
			{
&nbsp;
				$lang = $sitepress-&gt;get_current_language();
				$instance['category'] = $instance[$lang.'_category'];					
				$link_widget-&gt;widget($args, $instance);
&nbsp;
			}
&nbsp;
&nbsp;
&nbsp;
		}
&nbsp;
	}
&nbsp;
	function update($new_instance, $old_instance) {
&nbsp;
		$new_instance = (array) $new_instance;
		$instance = array( 'images' =&gt; 0, 'name' =&gt; 0, 'description' =&gt; 0, 'rating' =&gt; 0);
		foreach ( $instance as $field =&gt; $val ) {
			if ( isset($new_instance[$field]) )
				$instance[$field] = 1;
		}
&nbsp;
		$langs = $this-&gt;GetLangs();
		foreach($langs as $lang=&gt;$lang_id)
		{
			$instance[$lang.'_category'] = intval($new_instance[$lang.'_category']);
		}
&nbsp;
		return $instance;
&nbsp;
	}
&nbsp;
	function form($instance) {
&nbsp;
&nbsp;
&nbsp;
		$settings = $this-&gt;GetSettings();
		$langs = $this-&gt;GetLangs();
&nbsp;
		$instance = wp_parse_args( (array) $instance, $settings );
&nbsp;
		$link_cats = get_terms( 'link_category');
&nbsp;
		foreach($langs as $lang=&gt;$lang_id)
		{
			echo '&lt;p&gt;&lt;label for=&quot;'. $this-&gt;get_field_id($lang.'_category').'&quot;&gt;'. __('Select Link Category') . ' (' .$lang.'): &lt;/label&gt;';
			echo '&lt;select id=&quot;'. $this-&gt;get_field_id($lang.'_category').'&quot; name=&quot;'. $this-&gt;get_field_name($lang.'_category').'&quot;&gt;';
			foreach ( $link_cats as $link_cat ) {
&nbsp;
				echo '&lt;option value=&quot;' . intval($link_cat-&gt;term_id) . '&quot;'
				. ( $link_cat-&gt;term_id == $instance[$lang.'_category'] ? ' selected=&quot;selected&quot;' : '' )
				. '&gt;' . $link_cat-&gt;name . &quot;&lt;/option&gt;\n&quot;;
			}
			echo '&lt;/select&gt;&lt;/p&gt;';
&nbsp;
		}
		?&gt;
		&lt;p&gt;
		&lt;input class=&quot;checkbox&quot; type=&quot;checkbox&quot; <span style="color: #000000; font-weight: bold;">&lt;?php</span> checked<span style="color: #009900;">&#40;</span><span style="color: #000088;">$instance</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'images'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> id=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_id</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'images'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; name=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_name</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'images'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
		&lt;label for=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_id</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'images'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Show Link Image'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/label&gt;&lt;br /&gt;
		&lt;input class=&quot;checkbox&quot; type=&quot;checkbox&quot; <span style="color: #000000; font-weight: bold;">&lt;?php</span> checked<span style="color: #009900;">&#40;</span><span style="color: #000088;">$instance</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> id=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_id</span><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: #000000; font-weight: bold;">?&gt;</span>&quot; name=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_name</span><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: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
		&lt;label for=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_id</span><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: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Show Link Name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/label&gt;&lt;br /&gt;
		&lt;input class=&quot;checkbox&quot; type=&quot;checkbox&quot; <span style="color: #000000; font-weight: bold;">&lt;?php</span> checked<span style="color: #009900;">&#40;</span><span style="color: #000088;">$instance</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> id=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_id</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; name=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_name</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
		&lt;label for=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_id</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Show Link Description'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/label&gt;&lt;br /&gt;
		&lt;input class=&quot;checkbox&quot; type=&quot;checkbox&quot; <span style="color: #000000; font-weight: bold;">&lt;?php</span> checked<span style="color: #009900;">&#40;</span><span style="color: #000088;">$instance</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'rating'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> id=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_id</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rating'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; name=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_name</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rating'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
		&lt;label for=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field_id</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rating'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Show Link Rating'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/label&gt;
		&lt;/p&gt;
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> GetLangs<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #990000;">global</span> <span style="color: #000088;">$sitepress_settings</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$langs</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sitepress_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default_categories'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$langs</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> GetSettings<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$settings</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'images'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'rating'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$langs</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">GetLangs</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$langs</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$lang</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$lang_id</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$settings</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$lang</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_category'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$settings</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/brollyblog?a=yINjhiq9oEk:lXed1Tcsm94:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/brollyblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=yINjhiq9oEk:lXed1Tcsm94:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=yINjhiq9oEk:lXed1Tcsm94:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=yINjhiq9oEk:lXed1Tcsm94:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=yINjhiq9oEk:lXed1Tcsm94:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=yINjhiq9oEk:lXed1Tcsm94:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=yINjhiq9oEk:lXed1Tcsm94:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/brollyblog/~4/yINjhiq9oEk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brolly.ca/blog/wordpress/widget-to-translate-blog-link-categories-with-wpml/feed/</wfw:commentRss>
		<feedburner:origLink>http://brolly.ca/blog/wordpress/widget-to-translate-blog-link-categories-with-wpml/</feedburner:origLink></item>
		<item>
		<title>Use TinyMCE in your Wordpress 2.8 Plugin</title>
		<link>http://feedproxy.google.com/~r/brollyblog/~3/yd2z1H5Sr0c/</link>
		<comments>http://brolly.ca/blog/wordpress/use-tinymce-in-your-wordpress-28-plugin/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 16:44:08 +0000</pubDate>
		<dc:creator>Dan Imbrogno</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://brolly.ca/?p=400</guid>
		<description><![CDATA[Okay, so when you try to include the tinyMCE code using wordpress&#8217; built in wp_enqueue_script() function, it does absolutely nothing. If you try to manually include the script, you&#8217;ll end up with all sorts of javascript errors, and missing language translations. However, if you simply call wp_tiny_mce(); in the template_redirect or wp_head function, all the [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so when you try to include the tinyMCE code using wordpress&#8217; built in wp_enqueue_script() function, it does absolutely nothing. If you try to manually include the script, you&#8217;ll end up with all sorts of javascript errors, and missing language translations. However, if you simply call wp_tiny_mce(); in the template_redirect or wp_head function, all the javascript for tiny_mce is loaded properly. Then all you need to do, is run your tinymce.init script to setup your text editor. For example:</p>
<p><code><br />
<script type="text/javascript"><!--
		/* <! [CDATA[ */
		tinyMCE.init({
		theme : "advanced",
		mode : "exact",
		elements : "Cinemon_extra",
		width : "565",
		height : "200",</p>
<p>		});
		/* 
 */
//  &gt;
// --></script><br />
</code></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/brollyblog?a=yd2z1H5Sr0c:PY388STKWfc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/brollyblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=yd2z1H5Sr0c:PY388STKWfc:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=yd2z1H5Sr0c:PY388STKWfc:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=yd2z1H5Sr0c:PY388STKWfc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=yd2z1H5Sr0c:PY388STKWfc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=yd2z1H5Sr0c:PY388STKWfc:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=yd2z1H5Sr0c:PY388STKWfc:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/brollyblog/~4/yd2z1H5Sr0c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brolly.ca/blog/wordpress/use-tinymce-in-your-wordpress-28-plugin/feed/</wfw:commentRss>
		<feedburner:origLink>http://brolly.ca/blog/wordpress/use-tinymce-in-your-wordpress-28-plugin/</feedburner:origLink></item>
		<item>
		<title>Solution: Wordpress Pagination Stays On Same Page</title>
		<link>http://feedproxy.google.com/~r/brollyblog/~3/bHGzf1ko6rY/</link>
		<comments>http://brolly.ca/blog/wordpress/solution-wordpress-pagination-stays-on-same-page/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 18:04:30 +0000</pubDate>
		<dc:creator>Dan Imbrogno</dc:creator>
		
		<category><![CDATA[Q&A]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://brolly.ca/?p=391</guid>
		<description><![CDATA[This was a big head banger.
If you are are using query_posts multiple times on a page, and are trying to paginate the second loop on the page, the following
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
will always return 1, Unless you place wp_reset_query() below the previous loop.


	// Post template goes here.


Pagination should now work for the [...]]]></description>
			<content:encoded><![CDATA[<p>This was a big head banger.</p>
<p>If you are are using query_posts multiple times on a page, and are trying to paginate the second loop on the page, the following</p>
<p><code>$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;</code></p>
<p>will always return 1, Unless you place wp_reset_query() below the previous loop.</p>
<p><code><br />
<?php<br />
	rewind_posts();</p>
<p>	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;</p>
<p>	query_posts(<br />
		array(<br />
			'cat'=>&#8216;5&#8242;,<br />
			&#8216;orderby&#8217;=>&#8217;date&#8217;,<br />
			&#8216;order&#8217;=>&#8217;DESC&#8217;<br />
			)<br />
		); </p>
<p>	if(have_posts())<br />
	{<br />
?><br />
	// Post template goes here.<br />
<?php<br />
        }<br />
wp_reset_query();<br />
?><br />
</code></p>
<p>Pagination should now work for the next loop.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/brollyblog?a=bHGzf1ko6rY:j54knW79HNw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/brollyblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=bHGzf1ko6rY:j54knW79HNw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=bHGzf1ko6rY:j54knW79HNw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=bHGzf1ko6rY:j54knW79HNw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=bHGzf1ko6rY:j54knW79HNw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=bHGzf1ko6rY:j54knW79HNw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=bHGzf1ko6rY:j54knW79HNw:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/brollyblog/~4/bHGzf1ko6rY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brolly.ca/blog/wordpress/solution-wordpress-pagination-stays-on-same-page/feed/</wfw:commentRss>
		<feedburner:origLink>http://brolly.ca/blog/wordpress/solution-wordpress-pagination-stays-on-same-page/</feedburner:origLink></item>
		<item>
		<title>Template for Writing Your First Wordpress Plug-in</title>
		<link>http://feedproxy.google.com/~r/brollyblog/~3/G1dRBQlQNic/</link>
		<comments>http://brolly.ca/blog/wordpress/brolly-template-plugin/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 20:56:15 +0000</pubDate>
		<dc:creator>Dan Imbrogno</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://brolly.ca/?p=362</guid>
		<description><![CDATA[It seems like only yesterday, I set out to build my first ever Wordpress Plug-in. Bright eyed and bushy tailed, I poured over the Wordpress Codex, putting together the pieces of the process until I finally got the big picture. The Wordpress Codex is an amazing resource for anyone looking to get into Wordpress development; [...]]]></description>
			<content:encoded><![CDATA[<p>It seems like only yesterday, I set out to build my first ever Wordpress Plug-in. Bright eyed and bushy tailed, I poured over the Wordpress Codex, putting together the pieces of the process until I finally got the big picture. The Wordpress Codex is an amazing resource for anyone looking to get into Wordpress development; I strongly recommend any new developer read through the <a title="Wordpress: Writing a Plugin" href="http://codex.wordpress.org/Writing_a_Plugin">&#8220;Writing a Plugin&#8221;</a> section.</p>
<p>While learning, I had a difficult time finding a straightforward template I could use as a base for my plug-ins. I wanted something that was clean and well-organized but also provided examples of more complex behaviours, such as: Internationalization, Widgets and Front and Back-End Ajax. I wanted to ensure my plug-in functionality was encapsulated inside a class structure so my functions and variables wouldn&#8217;t conflict with the Wordpress Core, or other plug-ins.</p>
<p>I&#8217;ve finally gotten around to writing this template plug-in, and I thought I would share it with the community to get your feedback and improvements, and hopefully save new developers some time. If you are interested in learning how to build a plug-in, and have a strong programming background, you can look through my sample code, read the comments and pretty much piece together how everything works. If you want a more thorough description of what is going on, read through this article.</p>
<p>You can <a title="Wordpress: Brolly Template Plugin" href="http://wordpress.org/extend/plugins/brolly-wordpress-plugin-template/">download the plug-in</a> from the Wordpress Plugin directory.</p>
<h2>Getting Familiar With the Brolly Template Plug-in</h2>
<ol>
<li>Download the <a title="Wordpress: Brolly Template Plugin" href="http://wordpress.org/extend/plugins/brolly-wordpress-plugin-template/">template plug-in</a>.</li>
<li>Place the files in the plug-ins directory of your development installation of Wordpress.</li>
<li>Come up with a unique name for your plug-in, such as <strong>MyPlugin</strong>. Check the <a title="Wordpress: Plugin Directory" href="http://wordpress.org/extend/plugins/">Wordpress Plug-in directory</a> to ensure this name hasn&#8217;t been used.</li>
<li>Rename the plug-in folder from B2Template to your plug-in name (i.e. <strong>MyPlugin</strong>). Do not use spaces or special characters.</li>
<li>Rename the file B2Template.php to MyPlugin.php</li>
<li>Rename the file B2Template.class.php to MyPlugin.class.php</li>
<li>Rename the class inside MyPlugin.class.php from B2Template to MyPlugin</li>
<li>Rename the constructor function inside MyPlugin.class.php from B2Template() to MyPlugin()</li>
<li>Activate the plugin from the Wordpress Plugin Administration Panel</li>
<li>Add the Template widget to your sidebar from the Wordpress Appearance Administration Panel</li>
<li>View your site, and interact with the widget to observe it&#8217;s behaviour</li>
<li>From the Wordpress Administration page, click on Settings, and select <strong>MyPlugin.</strong></li>
<li>Interact with the plugin from this page, to view its behaviour.</li>
</ol>
<h2>How to Write a Plugin Using the Brolly Template Plug-in</h2>
<p>Note: Substitute <strong>B2Template</strong> in the instructions below, to whatever you named your plugin (i.e. <strong>MyPlugin</strong>).</p>
<p>There are two main files in the Brolly Wordpress Plug-in Template. The first, B2Template.php, is used to initialize the plugin and route various Wordpress actions and filters to class methods in the second file, B2Template.class.php. Keeping all our plug-in functions inside a class gives us greater flexibility to reuse the code we write for the plugin. It also prevents naming conflicts from occuring when multiple plug-ins use the same function or variable names.</p>
<p><span id="more-362"></span></p>
<h3>Actions</h3>
<p>After following the instructions above, the only modifications you should need to do to the B2Template.php file is adding or removing actions and filters. Wordpress uses actions to allow you to call plug-in functions after a specific event occurs. For example, you can register an action to call a plug-in function whenever a user deletes a post, publishes a page or whenever a comment is submitted. The Wordpress codex website provides <a title="Wordpress: Action Reference" href="http://codex.wordpress.org/Plugin_API/Action_Reference">a complete list</a> of available actions. The B2Template plugin includes the following actions by default:</p>
<ul>
<li>init: Fires when the plugin loads</li>
<li>admin_menu: Fires when wordpress is building the Administration menus on the back-end</li>
<li>wp_print_scripts: Fires when Wordpress is building the <head> tag for front-end pages</li>
<li>wp_admin_print_scripts: Fires when Wordpress is building the <head> tag for back-end pages</li>
<li>widgets_init: Fires when Wordpress is loading widgets</li>
</ul>
<p>You can easily add another action and route it to a function in the B2Template.class.php file by adding the following line to the B2Template.php file:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;ACTION NAME&gt;'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$b2_plugin</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;CLASS FUNCTION NAME&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Where you replace <ACTION NAME> with the Wordpress action you are adding, and <CLASS FUNCTION NAME> with the function inside B2Template.class.php you want to be called.</p>
<h3>Filters</h3>
<p>Filters are similar to actions, except they let you modify data as it is being saved to the Wordpress database, or modify it before it is displayed to the end user. The Wordpress Codex provides <a title="Wordpress: Filter Reference" href="http://codex.wordpress.org/Plugin_API/Filter_Reference">a complete list</a> of available filters. The B2Template provides the following filter by default:</p>
<ul>
<li>the_content: Passes the page or post content into the specified function as a string. You can then append, prepend or replace sections of this string using php, and then return the modified string at the end of the function. This is what will be displayed to the end user.</li>
</ul>
<p>To add another filter and route it to a function in the B2Template.class.php file, add the following line to the B2Template.php file:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;FILTER NAME&gt;'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$b2_plugin</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;CLASS FUNCTION NAME&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Where you replace <FILTER NAME> with the Wordpress filter you are adding, and <CLASS FUNCTION NAME> with the function inside B2Template.class.php you want to be called. Here is an example of a filter function, that makes all post and page content uppercase.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> make_upper_case<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$filtered_content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtoupper</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$filtered_content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Custom Actions</h3>
<p>The Brolly Wordpress plug-in template is setup to allow you to create custom actions very easily. To understand the purpose and usage of custom actions, consider the following example.</p>
<p>You want to build a plugin that adds a link to the end of every post, that lets users rate a post between 1 and 5.</p>
<p>To do this, you would first create a Filter (see above), that appends an HTML drop-down box and submit button to the end of each post. When the user clicks the submit button, you need your plug-in to save this data to your database table. To do this, you can have your submit button POST to http://<YOUR BLOG URL HERE>?B2Template_action=SaveTableData . Open the file B2Template.class.php, and scroll to the function ActionInit. This action gets called on every page load, so here you can check for the variable B2Template_action, and then call a class function based on whatever action you want perform. Here is an example of how you would use this function to save the submitted rating.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> ActionInit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #339933;">&lt;</span>pre<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#123;</span>
<span style="color: #339933;">&lt;</span>pre style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;padding-left: 30px; &quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000088;">$action</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pf</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetLanguage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$action</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;SaveTableData&quot;</span><span style="color: #339933;">:</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SaveTableData</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> SaveTableData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #990000;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Get POST data and perform SQL function to update database</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Saving Data</h3>
<p>If you only have a bit of data you need to collect from users, you can store this data in &#8220;Options&#8221;. Wordpress documents this well in the <a title="Wordpress: Creating Options Pages" href="http://codex.wordpress.org/Creating_Options_Pages">Creating Options Pages of the Wordpress Codex</a>. There is an implementation of this in the GetConfigHTML function of B2Template.class.php.</p>
<p>If you are collecting more data, it may be handy to create a table for your plugin in the Wordpress Database. This process is documented in the <a title="Wordpress: Creating Tables with Plugins" href="http://codex.wordpress.org/Creating_Tables_with_Plugins">Creating Tables with Plugins article of the Wordpress Codex</a>. An implementation of this can be found in the Activate function of B2Template.class.php.</p>
<h3>AJAX</h3>
<p>Ajax isn&#8217;t too difficult to do within the Wordpress framework. The B2Template provides examples of how to do AJAX calls from the front-end and back-end. The first step is to make sure the &#8216;SACK&#8217; javascript library is included. We do this by placing the following line in our ActionWpPrintScripts and ActionWpAdminPrintScripts functions in B2Template.class.php:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">wp_enqueue_script<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'sack'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Using Wordpress&#8217;s wp_enqueue_script function allows you to load javascript libraries that come bundled with Wordpress, such as Scriptaculous, jQuery and SACK. It also ensures that multiple plugins don&#8217;t include the same library multiple times, improving page load time. The ActionWpPrintScripts function wraps this call inside an IF statement so the library is only loaded when the Template Widget is being used. It&#8217;s a good idea to do this so you avoid loading unnecessary javascript on pages that don&#8217;t use it. Likewise, the ActionAdminWpPrintScripts calls the function, IsPluginConfigPage, which checks to see if the user is looking at the plug-ins configuration page.</p>
<p>Next you should include the javascript files that performs the Ajax calls.</p>
<p>ActionWpPrintScripts:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pf</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'js'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dir</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'/js/js.php?url='</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span>get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>ActionWpAdminPrintScripts:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pf</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'admin_js'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/js/admin_js.php?url='</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span>get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>These files can be found in the js/ folder. The JS files are saved as PHP, so that we can pass the blog&#8217;s url into the js files as query string variables. The following code demonstrates how to formulate an AJAX request that retrieves a result from the plug-in:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">function B2Template_sample_data_save( content )
{
	var mysack = new sack(
		   &quot;&lt;?php $_REQUEST[ 'url']; ?&gt;/wp-content/plugins/b2_template/b2_template.php&quot; ); 
&nbsp;
	  mysack.execute = 1;
	  mysack.method = 'POST';
	  mysack.setVar( &quot;B2Template_action&quot;, &quot;SaveTableData&quot; );
	  mysack.setVar( &quot;B2Template_sample_table_data&quot;, content );
	  mysack.encVar( &quot;cookie&quot;, document.cookie, false );
	  mysack.onError = function() { alert('Error saving data.' )};
	  mysack.runAJAX();
&nbsp;
	  return true;
&nbsp;
}</pre></div></div>

<p>In the first line, we specify the path to the plugin file. This is the file we are going to hit to return our result. The next line specifies that our Ajax call is going to return javascript that we want to be executed upon successful completion. The next line specifies that we are using the POST method. Next we set the variables we want to send to the server. Setting B2Template_action to SaveTableData means our Custom Action (see above) will handle the event. The next line states that we also want to POST the users COOKIE variables to the server as well (this isn&#8217;t totally necessary in this case). The next line specifies the javascript function that should run in case an error occurs. The final line executes the request.</p>
<p>NOTE: The class function you call using Ajax should echo out any javascript you want to run on the client side once the request is complete, and should then end with a call to  exit();.</p>
<p>For more information on Ajax in plugins view the article on <a title="Wordpress: Ajax in Plugins" href="http://codex.wordpress.org/AJAX_in_Plugins">Ajax in the Wordpress Codex</a>.</p>
<h3>Widgets</h3>
<p>Making widgets with plugins is very easy. The function ActionWidgetsInit gets called in B2Template.class.php when Wordpress is registering sidebar widgets. Simply place the following line inside that function to register a widget:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">register_sidebar_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Template Widget'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'TemplateWidget'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This line creates a Widget called &#8220;Template Widget&#8221;, and instructs Wordpress to call the function TemplateWidget, inside this Class when it needs to get the Widget Content.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">function</span> TemplateWidget<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$args</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #990000;">extract</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #990000;">echo</span> <span style="color: #000088;">$before_widget</span><span style="color: #339933;">.</span><span style="color: #000088;">$before_title</span><span style="color: #339933;">.</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Template Widget&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #000088;">$after_title</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">echo</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Here is a list of interesting words: &quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">echo</span> <span style="color: #0000ff;">'&lt;div id=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pf</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'widget&quot;&gt;
				'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">GetWidgetData</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
				&lt;/div&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">echo</span> <span style="color: #0000ff;">'&lt;form&gt;
					&lt;br /&gt;&lt;label&gt;&lt;strong&gt;'</span><span style="color: #339933;">.</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Add your own&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/strong&gt;&lt;/label&gt; &lt;input type=&quot;text&quot; id=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pf</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'sample_table_data&quot; name=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pf</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'sample_table_data&quot; /&gt;&lt;input type=&quot;button&quot; onclick=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pf</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'sample_data_save( document.getElementById('</span><span style="color: #0000ff;">'.$this-&gt;pf.'</span>sample_table_data<span style="color: #0000ff;">').value )&quot; value=&quot;'</span><span style="color: #339933;">.</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Submit&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;/&gt;
				&lt;/form&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">echo</span> <span style="color: #000088;">$after_widget</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This function prints out the widget content. It receives the variable $args, which is an array containing the HTML code the user has specified they want to place before the Widget, before the Widget title, after the Widget title, and after the Widget. (This lets them wrap your widget inside a LI list item, or inside DIV tags, to make it jive with the theme they are using.)</p>
<h3>Internationalization</h3>
<p>I won&#8217;t go too deep into detail about internationalizing your plug-in. It is a great idea to design your plugin to support this, and it&#8217;s really no extra work if you take this approach from the beginning. Suffice it to say, that whenever you display language-specific text to a user or administrator, you should wrap it a simple function that attempts to find a translation for your text. Here is an example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;This is a piece of text that can't be translated&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>becomes</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">echo</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;This is a piece of text that can be translated&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In this example, we are simply echoing out a piece of text. The second parameter specifies the namespace of the translation which we&#8217;ve set to be the Class name of the function. We need namespaces for translations to ensure our translations don&#8217;t conflict with those made for other plugins or in the Wordpress core.</p>
<p>In order for translations to work, we need to call the function SetLanguage as soon as the plugin begins formulating output. This function, shown below, simply loads the translation textdomain.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> SetLanguage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
load_plugin_textdomain<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">,</span> WP_PLUGIN_DIR<span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/lang'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/lang'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Your plug-in is now ready to be translated, however, there are a few more steps to do before someone can actually translate your plug-in. For more information visit <a title="Wordpress: Plugin Internationalization" href="http://codex.wordpress.org/Writing_a_Plugin#Internationalizing_Your_Plugin">Wordpress&#8217; documentation on Plugin Internationalization</a>.</p>
<h3>Conclusion</h3>
<p>Those are the basics of the plug-in. If you have any questions, comments or other feedback feel free to comment. If you are interested in contributing to this plug-in please let us know and we can add you to the Wordpress SVN repository.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/brollyblog?a=G1dRBQlQNic:nK_XvX8LIVw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/brollyblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=G1dRBQlQNic:nK_XvX8LIVw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=G1dRBQlQNic:nK_XvX8LIVw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=G1dRBQlQNic:nK_XvX8LIVw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=G1dRBQlQNic:nK_XvX8LIVw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=G1dRBQlQNic:nK_XvX8LIVw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=G1dRBQlQNic:nK_XvX8LIVw:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/brollyblog/~4/G1dRBQlQNic" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brolly.ca/blog/wordpress/brolly-template-plugin/feed/</wfw:commentRss>
		<feedburner:origLink>http://brolly.ca/blog/wordpress/brolly-template-plugin/</feedburner:origLink></item>
		<item>
		<title>Mayfair Theatre Case Study: Holy APIs Batman!</title>
		<link>http://feedproxy.google.com/~r/brollyblog/~3/a4NFCEu5bi0/</link>
		<comments>http://brolly.ca/blog/web-development/mayfair-theatre-case-study-holy-apis-batman/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 19:57:02 +0000</pubDate>
		<dc:creator>Dan Imbrogno</dc:creator>
		
		<category><![CDATA[Case Study]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[business]]></category>

		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://brolly.ca/?p=347</guid>
		<description><![CDATA[We&#8217;ve just rolled out a new project, here at Brolly. Our client is, the Mayfair Theatre, a local independently run movie theatre in Ottawa, Ontario. The theatre recently closed down for renovations and is now under new ownership. Their web site was in serious need of an update, so we took the opportunity to do [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve just rolled out a new project, here at Brolly. Our client is, <a href="http://mayfairtheatre.ca" target="_blank">the Mayfair Theatre</a>, a local independently run movie theatre in Ottawa, Ontario. The theatre recently closed down for renovations and is now under new ownership. Their web site was in serious need of an update, so we took the opportunity to do some really new and exciting things. We have been very excited about this project – it gave us great freedom to further develop our experience in social media and focus on providing meaningful interaction between our client and their customers.</p>
<p align="center"><a href="http://mayfairtheatre.ca" target="_blank"><img src="http://brolly.ca/wp-content/uploads/2009/03/mayfair-theatre-case-study.jpg" alt="Mayfair Theatre Case Study" title="Mayfair Theatre Case Study" width="450" height="505" class="aligncenter size-full wp-image-358" /></a></a></p>
<p>Like many of our other projects, the website is built upon the <a href="http://wordpress.org" target="_blank">WordPress platform</a>. We built a custom plugin for them to manage their upcoming movie listings. This plugin has some great features:</p>
<h3>IMDB Integration</h3>
<p>The Wordpress plugin allows the Mayfair Theatre to manage their upcoming movies and showtimes. Instead of forcing the administrator to enter in details for each movie that&#8217;s playing, we interfaced with a very neat movie database api, called The Movie Database, to allow them to import upcoming movie information, YouTube trailers and high quality artwork. This feature will saves huge amounts of time.</p>
<h3>Twitter Integration</h3>
<p>We set up the theatre with a twitter account, <a href="http://twitter.com/mayfairtheatre" target="_blank">@mayfairtheatre</a>, and used the Twitter API to automatically broadcast what movies are playing on a daily basis. We are encouraging users to follow the theatre&#8217;s Twitter account with a series of giveaways including: movie passes, free concession coupons and movie posters. We believe that keeping people informed of show times on a daily basis will greatly improve attendance.</p>
<h3>Google Calendar</h3>
<p>Another way we are keeping users up-to-date on the movie schedule is by integrating show times with Google Calendar using the Google API. This calendar stays synchronized with the online schedule and allows users to add the calendar to their computer and mobile devices.</p>
<p>By leveraging existing APIs we were able to build a lot of great functionality into the site, within a limited budget and short development cycle. It seems like every day we are finding new and exciting ways to expand WordPress to accommodate the diversity of our clients. Look for more exciting plugins and services coming soon!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/brollyblog?a=a4NFCEu5bi0:up0-SeFKeTo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/brollyblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=a4NFCEu5bi0:up0-SeFKeTo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=a4NFCEu5bi0:up0-SeFKeTo:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=a4NFCEu5bi0:up0-SeFKeTo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=a4NFCEu5bi0:up0-SeFKeTo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=a4NFCEu5bi0:up0-SeFKeTo:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=a4NFCEu5bi0:up0-SeFKeTo:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/brollyblog/~4/a4NFCEu5bi0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brolly.ca/blog/web-development/mayfair-theatre-case-study-holy-apis-batman/feed/</wfw:commentRss>
		<feedburner:origLink>http://brolly.ca/blog/web-development/mayfair-theatre-case-study-holy-apis-batman/</feedburner:origLink></item>
		<item>
		<title>Aurora Importing Case Study: Wordpress Plug-ins for Business Applications</title>
		<link>http://feedproxy.google.com/~r/brollyblog/~3/kAOPV2avATM/</link>
		<comments>http://brolly.ca/blog/web-development/aurora-importing-case-study-wordpress-plug-ins-for-business-applications/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 22:29:52 +0000</pubDate>
		<dc:creator>Dan Imbrogno</dc:creator>
		
		<category><![CDATA[Case Study]]></category>

		<category><![CDATA[Showcase]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://brolly.ca/?p=318</guid>
		<description><![CDATA[In response to the current state of the American economy many companies are looking for innovative methods of reducing costs. A business looking to develop or overhaul their corporate web presence should consider shedding their expensive content management system for a lower cost alternative. Companies have heard a great deal in the last few years [...]]]></description>
			<content:encoded><![CDATA[<p>In response to the current state of the American economy many companies are looking for innovative methods of reducing costs. A business looking to develop or overhaul their corporate web presence should consider shedding their expensive content management system for a lower cost alternative. Companies have heard a great deal in the last few years about the benefits of <a title="Open-souce" href="http://en.wikipedia.org/wiki/Open_source" target="_blank">open-source</a>. The recent culture of belt-tightening that has spread through all major industries provides companies with an excellent opportunity to explore these technologies.</p>
<p>Here at <a href="http://brolly.ca">Brolly</a>, we have just launched a new corporate website for <a href="http://www.auroraimporting.com">Aurora Importing and Distributing</a>, a medium sized Canadian food importing business, built entirely on the <a title="WordPress platform" href="http://wordpress.org/about/" target="_blank">WordPress platform</a>.</p>
<p align="center"><a href="http://brolly.ca/blog/web-development/aurora-importing-case-study-wordpress-plug-ins-for-business-applications/#more-318"><img class="aligncenter size-full wp-image-323" title="Auroa Importing" src="http://brolly.ca/wp-content/uploads/2009/01/auroa_importing.jpg" alt="Auroa Importing" width="450" height="507" /></a></p>
<p><span id="more-318"></span></p>
<p>The Aurora Importing and Distributing website gives an indication of how powerful WordPress can be as a professional grade CMS. Using Wordpress&#8217; plug-in functionality we were able to develop extensions to build a <a title="Aurora Importing and Distributing product locator" href="http://www.auroraimporting.com/locate-a-product" target="_blank">dynamic product locator</a> which interfaces beautifully with the <a title="Google Maps API" href="http://code.google.com/apis/maps/" target="_blank">Google Maps API</a>, an <a title="Aurora Importing and Distributing product catalogue" href="http://www.auroraimporting.com/catalogue">interactive product catalogue</a> as well as offer the entire website in both French and English. We have also developed a plug-in that enables the company to synchronize their internal corporate data with the web server to ensure the site stays as current as possible. Employees at the company were easily trained on the extremely easy-to-use WordPress administration system and are able to publish frequent updates. Affordable professional hosting solutions provided by companies such as <a title="Media Temple hosting solutions" href="http://http://www.mediatemple.net" target="_blank">Media Temple</a> allow you to host your website on reliable servers that will scale beautifully according to the demand on your web application.</p>
<p>WordPress has been in a constant state of development since 2003. Each iteration of the WordPress software is notoriously stable and upgrading is a painless process. It is easy to keep your website running with the latest offerings from the WordPress community allowing you to benefit from new security measures and added features. Many content management systems have poorly designed user interfaces, limited features and come with a hefty price tag. WordPress is gorgeous, robust and entirely free. Thanks to WordPress&#8217; API, third party developers are able to easily build custom software solutions that integrate with WordPress seamlessly.</p>
<p>Visit <a title="Aurora Importing and Distributing" href="http://www.auroraimporting.com" target="_blank">Aurora Importing and Distributing&#8217;s</a> new website and the <a href="http://wordpress.org/showcase/">Wordpress Showcase</a> for some inspiration on what can be achieved using the WordPress platform. To get an idea of what the WordPress interface looks like, try starting your own blog on <a href="http://www.wordpress.com">WordPress.com</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/brollyblog?a=kAOPV2avATM:XrzEWexikQI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/brollyblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=kAOPV2avATM:XrzEWexikQI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=kAOPV2avATM:XrzEWexikQI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=kAOPV2avATM:XrzEWexikQI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=kAOPV2avATM:XrzEWexikQI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=kAOPV2avATM:XrzEWexikQI:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=kAOPV2avATM:XrzEWexikQI:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/brollyblog/~4/kAOPV2avATM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brolly.ca/blog/web-development/aurora-importing-case-study-wordpress-plug-ins-for-business-applications/feed/</wfw:commentRss>
		<feedburner:origLink>http://brolly.ca/blog/web-development/aurora-importing-case-study-wordpress-plug-ins-for-business-applications/</feedburner:origLink></item>
		<item>
		<title>Q/A: How do I add multiple WordPress widget sidebars?</title>
		<link>http://feedproxy.google.com/~r/brollyblog/~3/SkEVYhK7IWs/</link>
		<comments>http://brolly.ca/blog/wordpress/add-multiple-wordpress-widget-sidebar/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 14:55:15 +0000</pubDate>
		<dc:creator>John Wiseman</dc:creator>
		
		<category><![CDATA[Q&A]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://brolly.ca/?p=304</guid>
		<description><![CDATA[I&#8217;m putting together my first WordPress theme which requires three dynamic sidebars (don&#8217;t ask!!). For some reason I can&#8217;t figure out how to add the other two dynamic sidebars.. Could you help me please?
Adding in multiple sidebars is fairly straightforward and you can create as many as you need.
Locate your functions.php file in your theme [...]]]></description>
			<content:encoded><![CDATA[<p><strong>I&#8217;m putting together my first WordPress theme which requires three dynamic sidebars (don&#8217;t ask!!). For some reason I can&#8217;t figure out how to add the other two dynamic sidebars.. Could you help me please?</strong></p>
<p>Adding in multiple sidebars is fairly straightforward and you can create as many as you need.</p>
<p>Locate your functions.php file in your theme and add the following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'register_sidebar'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
          register_sidebar<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
          <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Sidebar One'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// The sidebar name to register</span>
          <span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div class=&quot;widget&quot;&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;h3&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/h3&gt;'</span><span style="color: #339933;">,</span>
     <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><span id="more-304"></span></p>
<p>You should be customizing and styling these values to match your WordPress theme.</p>
<p>To add additional sidebars simply repeat the code only changing the &#8216;name&#8217; value. I registered three sidebars in the example below:</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
25
26
27
28
29
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
     <span style="color: #666666; font-style: italic;">// The first sidebar</span>
     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'register_sidebar'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
          register_sidebar<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
          <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Sidebar One'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// The sidebar name to register</span>
          <span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div class=&quot;widget&quot;&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;h3&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/h3&gt;'</span><span style="color: #339933;">,</span>
     <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #666666; font-style: italic;">// The second sidebar</span>
     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'register_sidebar'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
          register_sidebar<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
          <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Sidebar Two'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// The sidebar name to register</span>
          <span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div class=&quot;widget&quot;&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;h3&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/h3&gt;'</span><span style="color: #339933;">,</span>
     <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #666666; font-style: italic;">// The third sidebar</span>
     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'register_sidebar'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
          register_sidebar<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
          <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Sidebar Three'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// The sidebar name to register</span>
          <span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div class=&quot;widget&quot;&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;h3&gt;'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/h3&gt;'</span><span style="color: #339933;">,</span>
     <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Finally you need to add each dynamic sidebar into your WordPress theme. Figure out where they should go and use the following code to activate each dynamic sidebar:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
     <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'dynamic_sidebar'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span>dynamic_sidebar<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Sidebar One'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Each sidebar name</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
     <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/brollyblog?a=SkEVYhK7IWs:OGRWjGCSSG8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/brollyblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=SkEVYhK7IWs:OGRWjGCSSG8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=SkEVYhK7IWs:OGRWjGCSSG8:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=SkEVYhK7IWs:OGRWjGCSSG8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=SkEVYhK7IWs:OGRWjGCSSG8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=SkEVYhK7IWs:OGRWjGCSSG8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=SkEVYhK7IWs:OGRWjGCSSG8:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/brollyblog/~4/SkEVYhK7IWs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brolly.ca/blog/wordpress/add-multiple-wordpress-widget-sidebar/feed/</wfw:commentRss>
		<feedburner:origLink>http://brolly.ca/blog/wordpress/add-multiple-wordpress-widget-sidebar/</feedburner:origLink></item>
		<item>
		<title>Blogging 101: Wrap Up!</title>
		<link>http://feedproxy.google.com/~r/brollyblog/~3/v-hqqyKAu4I/</link>
		<comments>http://brolly.ca/blog/blogging-tips/blogging-101-wrap-up/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 17:09:43 +0000</pubDate>
		<dc:creator>John Wiseman</dc:creator>
		
		<category><![CDATA[Blogging Tips]]></category>

		<category><![CDATA[101]]></category>

		<category><![CDATA[blogging]]></category>

		<category><![CDATA[tips]]></category>

		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://brolly.ca/?p=298</guid>
		<description><![CDATA[We completed our series on practical tips for writing a successful blog.
The entries from start to finish are linked below:

Blogging 101: Anatomy of a Blog
Blogging 101: Blogging Lingo
Blogging 101: Before you Begin
Blogging 101: Writing Tips
Blogging 101: Networking Tips
Blogging 101: Networking Tips (Part: 2)
Blogging 101: Final Thoughts

]]></description>
			<content:encoded><![CDATA[<p>We completed our series on practical tips for writing a successful blog.</p>
<p>The entries from start to finish are linked below:</p>
<ul>
<li><a title="Blogging 101: Anatomy of a Blog" href="http://brolly.ca/blog/blogging-tips/blogging-101-anatomy-of-a-blog/">Blogging 101: Anatomy of a Blog</a></li>
<li><a title="Blogging 101: Blogging Lingo" href="http://brolly.ca/blog/blogging-tips/blogging-101-blogging-lingo/">Blogging 101: Blogging Lingo</a></li>
<li><a title="Blogging 101: Before you Begin" href="http://brolly.ca/blog/blogging-tips/blogging-101-before-you-begin/">Blogging 101: Before you Begin</a></li>
<li><a title="Blogging 101: Writing Tips" href="http://brolly.ca/blog/blogging-tips/blogging-101-writing-tips/">Blogging 101: Writing Tips</a></li>
<li><a title="Blogging 101: Networking Tips" href="http://brolly.ca/blog/blogging-tips/blogging-101-networking-tips/">Blogging 101: Networking Tips</a></li>
<li><a title="Blogging 101: Networking Tips (Part: 2)" href="http://brolly.ca/blog/blogging-tips/blogging-101-networking-tips-part-2/">Blogging 101: Networking Tips (Part: 2)</a></li>
<li><a title="Blogging 101: Final Thoughts" href="http://brolly.ca/blog/blogging-tips/blogging-101-final-thoughts/">Blogging 101: Final Thoughts</a></li>
</ul>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/brollyblog?a=v-hqqyKAu4I:VXkED55_MVs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/brollyblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=v-hqqyKAu4I:VXkED55_MVs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=v-hqqyKAu4I:VXkED55_MVs:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=v-hqqyKAu4I:VXkED55_MVs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=v-hqqyKAu4I:VXkED55_MVs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=v-hqqyKAu4I:VXkED55_MVs:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=v-hqqyKAu4I:VXkED55_MVs:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/brollyblog/~4/v-hqqyKAu4I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brolly.ca/blog/blogging-tips/blogging-101-wrap-up/feed/</wfw:commentRss>
		<feedburner:origLink>http://brolly.ca/blog/blogging-tips/blogging-101-wrap-up/</feedburner:origLink></item>
		<item>
		<title>Blogging 101: Final Thoughts</title>
		<link>http://feedproxy.google.com/~r/brollyblog/~3/u0tHumJ93Xw/</link>
		<comments>http://brolly.ca/blog/blogging-tips/blogging-101-final-thoughts/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 11:00:00 +0000</pubDate>
		<dc:creator>John Wiseman</dc:creator>
		
		<category><![CDATA[Blogging Tips]]></category>

		<category><![CDATA[101]]></category>

		<category><![CDATA[blogging]]></category>

		<category><![CDATA[tips]]></category>

		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://brolly.ca/?p=91</guid>
		<description><![CDATA[You may be surprised at some rewarding benefits of blogging that you may experience:

Research that you do from blogging on different topics will be well archived for later retrieval.
Making your business more transparent, open and honest improves client relations.
Future clients can assess your expertise by consulting the blog in which you have articulated your approach [...]]]></description>
			<content:encoded><![CDATA[<p>You may be surprised at some rewarding benefits of blogging that you may experience:</p>
<ul>
<li>Research that you do from blogging on different topics will be well archived for later retrieval.</li>
<li>Making your business more transparent, open and honest improves client relations.</li>
<li>Future clients can assess your expertise by consulting the blog in which you have articulated your approach and complex ideas clearly and effectively.</li>
<li>Feedback from readers will give you valuable information with which to improve your business approach.</li>
<li>Participation in a community of professional peers will give you valuable business resources.</li>
</ul>
<p>All this and more can result from a blog that works for you. So, to summarize, some of our most important recommendations for developing a successful business blog:</p>
<p><strong>1. Cultivate a writing style that is characterized by an honest and authentic perspective that demonstrates your passion and expertise.</strong> Potential clients reading the blog will be drawn to authenticity above all else - they are not interested in reading promotional writing from the cold voice of a seemingly large business. They would like to support businesses run by people who love what they do and who are able to express their knowledge effectively.</p>
<p><strong>2. Commit to regular posting to encourage loyal readers.</strong> Readers subscribe to blogs that are active with regular posts - the frequency of posting will reflect on the activity and vigour of the business itself.</p>
<p><strong>3. Write posts that are on topic and of reasonable length (500 words is a good number to aim for).</strong></p>
<p><strong>4. Link abundantly to helpful resources for your readers and the posts of other blogs.</strong> If you make your site rich with resources in your industry, it will help to establish your business&#8217; reputation and attract new clients and like-minded thinkers to help your business grow.</p>
<p><span id="more-91"></span><strong>5. Respond with meaningful comments on the posts of other blogs, as well as those on your own blog.</strong> Build relationships  in the blogosphere that will help to develop your business and create new opportunities. Make sure that your blog readers know you&#8217;re reading their comments and appreciating their feedback. If you keep the lines of communication open and active, potential clients will not hesitate to approach you.</p>
<p><strong>6. Put yourself in the shoes of your readers and create posts that have value.</strong></p>
<p><strong>7. Use headlines that stand out and include relevant keywords.</strong></p>
<p><strong>8. Use embedded videos and images to enhance information and encourage readership.</strong> Make your blog an interesting place where you discuss your business and industry - if the atmosphere of the blog and its posts demonstrate expertise, enthusiasm and useful knowledge, you are more likely to attract a devoted readership.</p>
<p><strong>9. Create a clear company blogging policy and/or comment moderation policy.</strong> Make it clear to your employee bloggers what is expected for the blog to ensure ongoing success.</p>
<p><strong>10. Have fun! It shows.</strong></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/brollyblog?a=u0tHumJ93Xw:ePf84bsKGRk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/brollyblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=u0tHumJ93Xw:ePf84bsKGRk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=u0tHumJ93Xw:ePf84bsKGRk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=u0tHumJ93Xw:ePf84bsKGRk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=u0tHumJ93Xw:ePf84bsKGRk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=u0tHumJ93Xw:ePf84bsKGRk:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=u0tHumJ93Xw:ePf84bsKGRk:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/brollyblog/~4/u0tHumJ93Xw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brolly.ca/blog/blogging-tips/blogging-101-final-thoughts/feed/</wfw:commentRss>
		<feedburner:origLink>http://brolly.ca/blog/blogging-tips/blogging-101-final-thoughts/</feedburner:origLink></item>
		<item>
		<title>Blogging 101: Networking Tips (Part: 2)</title>
		<link>http://feedproxy.google.com/~r/brollyblog/~3/BcKUsJmFXZ4/</link>
		<comments>http://brolly.ca/blog/blogging-tips/blogging-101-networking-tips-part-2/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 11:00:00 +0000</pubDate>
		<dc:creator>John Wiseman</dc:creator>
		
		<category><![CDATA[Blogging Tips]]></category>

		<category><![CDATA[101]]></category>

		<category><![CDATA[blogging]]></category>

		<category><![CDATA[tips]]></category>

		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://brolly.ca/?p=108</guid>
		<description><![CDATA[Monitoring Blogging Success
Once blogging on a regular basis and beginning to build new relationships, it can be helpful to keep track of the progress of your blog. Statistics are easy to review for ongoing measurable information about the readers of your blog.
Recommended tools for monitoring statistics are:

A Google Analytics account that will give you detailed [...]]]></description>
			<content:encoded><![CDATA[<h3>Monitoring Blogging Success</h3>
<p>Once blogging on a regular basis and beginning to build new relationships, it can be helpful to keep track of the progress of your blog. Statistics are easy to review for ongoing measurable information about the readers of your blog.</p>
<p>Recommended tools for monitoring statistics are:</p>
<ul>
<li>A <a title="Google Analytics" href="http://www.google.com/analytics" target="_blank">Google Analytics</a> account that will give you detailed information on who is visiting your site.</li>
<li>A <a title="Feedburner" href="http://www.feedburner.com" target="_blank">Feedburner</a> account that will keep track of the number of subscribers.</li>
</ul>
<p>You can also visit major blog search engines to find link citations to your site made by other bloggers. A few popular blog search engines are: <a title="Technorati" href="http://www.technorati.com" target="_blank">Technorati</a>, <a title="Feedster" href="http://www.feedster.com" target="_blank">Feedster</a>, <a title="Blog Pulse" href="http://www.blogpulse.com" target="_blank">Blogpulse</a> and <a title="Bloglines" href="http://www.bloglines.com" target="_blank">Bloglines</a>.</p>
<p>In measuring your overall ROI and blog success, there are several metrics it can be helpful to review:</p>
<p><span id="more-108"></span></p>
<ul>
<li>Traffic (unique visits, page views and bounce rate)</li>
<li>Length of time readers spend on your blog</li>
<li>Total subscribers through RSS and Email</li>
<li>Comments (total number and quality)</li>
<li>Popularity on social bookmarking web sites</li>
<li>Incoming links (where visitors are referred from)</li>
<li>Total trackbacks</li>
<li>Search engine ranking</li>
<li>Blog ranking (on web sites such as Technorati)</li>
</ul>
<p>Data from all of these sources will give you important information to help you improve your blog over the long term. Individual pages with a large amount of views could indicate that it is a topic readers are interested in or the quality of the post was especially good. Consider observing these trends in order to develop future posts for content that will be valuable to readers.</p>
<p>Negative or constructive feedback from the trackbacks of other bloggers may need to be responded to in a post. Especially positive trackbacks can be responded to by leaving a personal comment on their blog, fostering that new connection.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/brollyblog?a=BcKUsJmFXZ4:_RT0w0EVmyk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/brollyblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=BcKUsJmFXZ4:_RT0w0EVmyk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=BcKUsJmFXZ4:_RT0w0EVmyk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=BcKUsJmFXZ4:_RT0w0EVmyk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=BcKUsJmFXZ4:_RT0w0EVmyk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/brollyblog?a=BcKUsJmFXZ4:_RT0w0EVmyk:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/brollyblog?i=BcKUsJmFXZ4:_RT0w0EVmyk:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/brollyblog/~4/BcKUsJmFXZ4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brolly.ca/blog/blogging-tips/blogging-101-networking-tips-part-2/feed/</wfw:commentRss>
		<feedburner:origLink>http://brolly.ca/blog/blogging-tips/blogging-101-networking-tips-part-2/</feedburner:origLink></item>
	</channel>
</rss>
