Skip to content

SBM Monthly Archive Widget needs Post Count!

October 10, 2007

I use K2 as the theme for my main blog. I like it. It’s graceful, it’s beautiful, it’s simple. Coming with it is the totally awesome Mr. Nybble’s Sidebar Modules. Now, SBM is great. It’s jammed with features.

But one day I noticed that it didn’t have the post count on it’s Monthly Archive widget. Oh, what a pity. WordPress Widgets had it.

So I set out to create a widget that had it.

Now, I’ve registered for a space on WordPress Plugins (I made a plugin) but I don’t have SVN, so sigh.

The code is below, where someone’s eyes might rest on it. Hopefully.

<?php
function months_sidebar_module2($args) {
extract($args);
$c = $options['count'] ? '1' : '0';
echo($before_module . $before_title . $title . $after_title);
?>
<ul>
<?php wp_get_archives('type=monthly&show_post_count=$c'); ?>
</ul>
<?php
echo($after_module);
}
register_sidebar_module('Monthly Archives with Post Count', 'months_sidebar_module2', 'sb-months');
?>

Now, basicly, this very simple chunk of code is a sidebar module. To use it, copy it into your SBM modules directory. (for K2ers, it’s wp-content/themes/k2/app/modules/)

If you find it useful in ANY way, please let me know.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: