WordPress Plugin: Collapsible Archive Widget

Update: 20 January 2010: This plugin has not been tested with WordPress 2.9 and may break because 2.9 has internal changes. I am still trying to find time. Sorry for the Inconvenience.

I have written another simple WordPress plugin that simply display a collapsible archive in the sidebar. You can see it in action in the rightmost sidebar of the main page.

When the sidebar loads, it is in collapsed state and can be expanded by clicking the years. It utilizes simple JavaScript that shows and hides a div containing the monthly links. The purpose of this plugin is to save space on the sidebar especially if you have been blogging for a while. It is an alternative to the combo box (select) provided by the default archive widget.

My request for the plugin to be listed in the WordPress Plugin Directory has been pending for a while so for now it can be downloaded here.

The plugin can now be downloaded here.

Configuration:

  • Widget Title: the title of the widget
  • Show post counts for year: Whether or not to show the post number for each year
  • Show post counts for month: Whether or not to show the post number for each month
  • Abbreviate month names: Check this box to show abbreviation of month names
  • Hide year from month names: Do not print year after month names
  • Use script.aculo.us effects: Whether or not to show effects
  • Expand effect: Effect to use when expanding the list
  • Collapse effect: Effect to use when collapsing the list
  • Expand the list by default: Check this box to have the list expanded when loaded
  • Expand current year by default: Check this box to have the current year expanded when loaded
  • Expand current month by default: Check this box to have the current month expanded when loaded
  • Show individual posts: Show posts in the list. This should be used in extra caution; if you have a lot of posts consider disabling it as this will take time to load
  • Use HTML arrows instead of images (► ▼)
  • Show current month in bold: show current month in bold
  • Show a link to plugin page. Thank you for your support! : Display a link to plugin page (this page) as a support method

Current Version: 2.3.1

Installation

Copy the file to the wp-content/plugins/widgets directory and activate it in the Plugins page. Then drag and configure it in the Sidebar Widgets page.

Warning: Will only work on widgets enabled blogs.

TODO (these are being considered but there is no guarantee when they are going to be included)

  • Add ability for multiple instances
  • Add ability to work as non-widget
  • Add ability to include / exclude categories
  • Expand previous month rather the current
  • Research the practicality to use CSS / allow CSS options
  • List posts without year and month headers (for blogs with few posts)
  • Do not list the posts that are listed on the main page

Change Log

  • 03-Aug-2007: Initial version
  • 04-Sep-2007: Added ability to select whether to use abbreviations for the month names, and script.aculo.us effects!
  • 27-Sep-2007: Fixed javascript include – effects.js added and scriptaculous.js removed (For some reason it worked in 2.2)
  • 10-Nov-2007: Added ability to display posts (with caution), to expand by default, and also added plus and minus signs as expand/collapse buttons
  • 24-Aug-2008: Multiple updates:
    • Enqueue javascripts using WordPress API wp_enqueue_script
    • Validation as XHTML 1.0 Transitional
    • Add option to expand current year and/or month by default
    • REMOVED list type option
    • Added ability to upload own plus and minus images
    • Added ability to display plugin link. If you’d like to support this plugin, having the “powered by” on your blog is the best way; it’s our only promotion or advertising.
  • 25-Aug-2008: Bugfix to not load javascripts when effects is not used
  • 25-Aug-2008: Javascript code factoring and added ability to use HTML arrows
  • 16-Mar-2009: Separated year and month posts counts, added option to hide year after month names, ability to show current month in bold, enabled localized title
  • 17-Mar-2009: Fixed valid XHTML, and highlight (bold) bugfix


BIG FAT WARNING

The ability to display posts is provided after receiving so many requests for it. This feature is not practical for those with many posts in a month. Enabling it means that there is a lot more data that needs to be received by the browser, not to mention the load on the database. It is, however works very nice for blogs with low post count. Please use at your own risk and remember to test it.

Notes:

11-Nov-2007: I’d like to thank Meitar Moscovitz who tried his best to provide a patch to display posts in the list. I rewritten some of the code for version 2.1 based on his logic. Thank you!
25-Aug-2008: Thanks to Berny for his idea of re factoring the javascript code and also for providing HTML arrows option.

If you find this plugin useful, feel free to


0 Shares

132 thoughts on “WordPress Plugin: Collapsible Archive Widget”

  1. Hi and thanks for the great plugin! One feature request. Not sure if it’s possible, just throwing out the idea.

    It would be nice if it would output all posts as the original Archive does if a user with JavaScript disabled visited the site.

    Well thanks again!

  2. Firstly sorry for the delay in responding, I have been unable to even look at the blog lately.

    Michael and Tweakenout: I hear you, but I can’t promise when I can make the necessary changes. One thing I know is that the management (settings) have to go somewhere. A simple thing about widgets is that the settings are consolidated into the widgets page itself.

    Ola: I think that is possible using the noscript tag, I’ll experiment more if I can find time.

  3. Thanks a lot for great widget. One more voice to make it for category’s as well. It would be very useful for making WP even more CMS-like. Cheers and a little stumble for you to get you some traffic.

  4. Hi ady, neat little plug-in here. I do have one question though, would it be possible to make a sister plug-in for the blogroll/links?

  5. I have a question regarding duplicating your archive widget. As it stands, I install and activate your awesome plugin and I get a single widget. However, I have different sidebar templates for my landing page, single post view and archives view. I would like to add your widget to all three, but can’t because I’ve given one instance. I’ve tried another plugin that is suppose to duplicate widgets, but my dupes of Collapsible Archive don’t display. Any ideas on how I can increase the widget availability to 3 instances, one for each of my sidebars?

    Thanks in advance!

  6. Looks like a really great widget. Is there php code I can put in my sidebar as an alternative to using it as a widget? I’m working on a new theme but the widget of course appears in my current theme

  7. this sounds like a great plug-in that will do exactly what i want – but where do i download it??? i can’t for the life of me find a download link that works : (

  8. Many thanks for this great awsome widget! I spent hours on searching and searching… and here it is 🙂 I got one question: Is it possible to add a setting that makes the current year (months so far) expanded and older years collapsed by default? Can I use own pics instead of plus/minus? Thanks!

  9. hi ady,

    thanks for the nice plugin.

    just a quick suggestion: can you use the function wp_enque_script(); for the scripts instead of including them manually. – this would avoid doubled calls…

    greetz,
    berny

Comments are closed.