My theme originally had widget support before widgets were incorporated into the core of WordPress. I removed all the code when I started customizing it. The existing code, for a plugin, wasn't compatible with the new WordPress code.
I now have widget support in my theme. I spent the last several hours rewriting my sidebar.php file and adding the required functions to my functions.php file. I'm now in the process of converting my existing widget blocks to true WordPress widgets. Why is it important for me to do this? I'm also in the process of writing plugins with widget support.
You see that RSS widget in my sidebar? I changed a little code in the Feed Count 1.2 Wordpress Plugin (making the output pure plain text in the widget title) and added widget code to the very end of the plugin. I changed this:
print "<div class='feedcountdiv'><p>$openlink<span class='feedcount'>\n";
if ($map_fc_before) {
print " <span class='before'>$map_fc_before</span>\n";
}print "<span class='subscribers'>$number</span>\n";
if ($map_fc_after) {
print " <span class='after'>$map_fc_after</span>\n";
}
print "</span>$closelink</p></div>";
to just this:
print " $number Feed Subscribers";
and added this to the very end:
<?php
add_action('plugins_loaded', 'rss_special_widget_init');
function rss_special_widget_init() {
if (function_exists('register_sidebar_widget') && function_exists('register_widget_control')) {
register_sidebar_widget('RSS Special', 'rss_special_widget');
}
}
function rss_special_widget($args) {
extract($args);
echo $before_widget;
echo $before_title;
echo '<img src="/images/feed-icon16×16.png" height="16" width="16" style="margin-bottom:-2px;" alt="" />'; fc_feedcount();
echo $after_title;
echo '<ul>';
echo '<li><a href="http://feeds.feedburner.com/UntwistedVortex" rel="nofollow">Full Article Feed</a></li>';
echo '<li><a href="http://feeds.feedburner.com/untwistedvortex/summary" rel="nofollow">Summary Article Feed</a></li>';
echo '<li><a href="http://feeds.feedburner.com/CommentsForUntwistedVortex" rel="nofollow">Comments Feed</a></li>';
echo '<li><a href="http://www.feedburner.com/fb/a/emailverifySubmit?feedId=668914&loc=en_US" rel="nofollow">Subscribe by Email (Full)</a></li>';
echo '</ul>';
echo $after_widget;
}
?>
I'm only using it on my local sandbox right now and I don't plan to move it online until I finish all the widgets. Another reason for doing all this work is so that I can use Stephen Cronin's IFrameWidgets plugin to prevent JavaScript widget slowdowns. I should be getting to that as soon as I finish the rest of the widgets.
Now since I'm completely beat, I'm hitting the sack for a few hours.



