WordPress.org

Plugin Directory

Collapsing Archives

This plugin uses Javascript to dynamically expand or collaps the set of months for each year and posts for each month in the archive listing.

Demo

I use this plugin in my blog at http://blog.robfelty.com

OPTIONS AND CONFIGURATIONS

$defaults=array(
  'noTitle' => '',
  'inExcludeCat' => 'exclude',
  'inExcludeCats' => '',
  'inExcludeYear' => 'exclude',
  'inExcludeYears' => '',
  'sort' => 'DESC',
  'showPages' => false, 
  'linkToArch' => true,
  'showYearCount' => true,
  'expandCurrentYear' => true,
  'expandMonths' => true,
  'expandYears' => true,
  'expandCurrentMonth' => true,
  'showMonthCount' => true,
  'showPostTitle' => true,
  'expand' => '0',
  'showPostDate' => false,
  'postDateFormat' => 'm/d',
  'postDateAppenc' => 'after',
  'accordion' => 0,
  'postTitleLength' => '',
  'post_type' => 'post',
  'debug' => '0',
  );
  • noTitle
    • If your posts don't have title, specify a string to show in place of the title
  • inExcludeCat
    • Whether to include or exclude certain categories
      • 'exclude' (default)
      • 'include'
  • inExcludeCats
    • The categories which should be included or excluded
  • inExcludeYear
    • Whether to include or exclude certain years
      • 'exclude' (default)
      • 'include'
  • inExcludeYears
    • The years which should be included or excluded
  • showPages
    • Whether or not to include pages as well as posts. Default if false
  • showYearCount
    • When true, the number of posts in the year will be shown in parentheses
  • showMonthCount
    • When true, the number of posts in the month will be shown in parentheses
  • linkToArch
    • 1 (true), clicking on a the month or year will link to the archive (default)
    • 0 (false), clicking on a month or year expands and collapses
  • sort
    • Whether posts should be sorted in chronological or reverse chronological order. Possible values:
      • 'DESC' reverse chronological order (default)
      • 'ASC' chronological order
  • expand
    • The symbols to be used to mark expanding and collapsing. Possible values:
      • '0' Triangles (default)
      • '1' + -
      • '2' [+] [-]
      • '3' images (you can upload your own if you wish)
      • '4' custom symbols
  • customExpand
    • If you have selected '4' for the expand option, this character will be used to mark expandable link categories
  • customCollapse

    • If you have selected '4' for the expand option, this character will be used to mark collapsible link categories
  • expandYears

    • 1 (true): Years collapse and expand to show months (default)
    • 0 (false): Only links to yearly archives are shown
  • expandMonths
    • 1 (true): Months collapse and expand to show posts (default)
    • 0 (false): Only links to yearly and monthly archives are shown
  • expandCurrentMonth
    • When true, the current month will be expanded by default
  • expandCurrentYear
    • When true, the current year will be expanded by default
  • showPostTitle
    • 1 (true): The title of each post is shown (default)
  • showPostDate
    • 1 (true): Show the date of each post
  • postDateFormat
    • The format in which the date should be shown (default: 'm/d')
  • postDateAppend
    • after: The post date comes after the title (default)
    • before: The post date comes before the title
  • postTitleLength
    • Truncate post titles to this number of characters (default: 0 = don't truncate)
  • post_type
    • post (default)
    • page
    • all (includes regular post types plus any custom post types - excludes pages, revisions, wp_nav_items, and attachments)
    • custom post type that you have registered (e.g. recipe)
  • accordion
    • When set to true, expanding one year will collapse all other years. Expanding one month will collapse all other months in that year
  • number
    • If using manually with more than one instance on a page, you can give unique ids to each instance with this option. For example, if you had one instance with number 1 and another with number 2, the ul for March 2004 for number 1 would have an id of 'collapsArch-2004-3:1', while the id for number 2 would be 'collapsArch-2004-3:2'
  • debug
    • When set to true, extra debugging information will be displayed in the underlying code of your page (but not visible from the browser). Use this option if you are having problems

Examples

collapsArch('accordion=1&sort=ASC&expand=3&inExcludeCat=exclude&inExcludeCats=general,uncategorized')

This will produce a list with: * accordion style expanding and collapsing * shown in chronological order * using images to mark collapsing and expanding * exclude posts from the categories general and uncategorized

collapsArch('post_type=recipe')

This will produce a list with: * only posts of type 'recipe' * shown in chronological order * using images to mark collapsing and expanding * exclude posts from the categories general and uncategorized

CAVEAT

This plugin relies on Javascript, but does degrade gracefully if it is not present/enabled to show all of the archive links as usual.

Requires: 2.8 or higher
Compatible up to: 4.0.5
Last Updated: 2014-9-24
Active Installs: 9,000+

Ratings

4.9 out of 5 stars

Support

0 of 2 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

1 person says it works.
0 people say it's broken.

100,2,2
100,1,1
100,2,2
75,4,3 100,3,3
67,6,4
0,1,0 50,2,1 100,3,3
89,9,8
100,1,1
100,2,2
0,1,0
0,1,0 100,1,1
100,1,1
100,3,3
100,1,1
100,1,1
90,10,9
100,2,2
44,9,4 17,6,1
33,12,4
14,7,1
50,6,3
0,2,0
100,1,1
0,2,0
100,1,1
0,2,0
0,1,0
100,1,1
100,1,1