Title: Collapsing Archives
Author: robfelty
Published: <strong>7 de Xaneiro, 2008</strong>
Last modified: 12 de Febreiro, 2026

---

Buscar plugins

![](https://ps.w.org/collapsing-archives/assets/banner-772x250.gif?rev=2550328)

![](https://ps.w.org/collapsing-archives/assets/icon-256x256.gif?rev=2550328)

# Collapsing Archives

 Por [robfelty](https://profiles.wordpress.org/robfelty/)

[Descargar](https://downloads.wordpress.org/plugin/collapsing-archives.3.0.8.zip)

 * [Detalles](https://gl.wordpress.org/plugins/collapsing-archives/#description)
 * [Valoracións](https://gl.wordpress.org/plugins/collapsing-archives/#reviews)
 *  [Instalación](https://gl.wordpress.org/plugins/collapsing-archives/#installation)
 * [Desenvolvemento](https://gl.wordpress.org/plugins/collapsing-archives/#developers)

 [Soporte](https://wordpress.org/support/plugin/collapsing-archives/)

## Descrición

Create collapsible archives by year or month. Features include: link to archive 
pages, display of individual posts and support for custom post-types.

### Demo

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

## Capturas

 * [[
 * Collapsing archives with default theme
 * [[
 * widget options

## Blocks

Este plugin proporciona 1 bloque.

 *   Collapsing Archives A Gutenberg block to show a collapsible list of your posts
   organized by date

## Instalación

#### WIDGET INSTALLATION

The easiest way to use this plugin is as a widget.

After you have installed the Collapsing Archives plugin, then simply go the Appearance
> Widgets section in wp-admin and add the Collapsing Archives Widget to whatever
sidebar or widget section you like, and then configure to your heart’s content.

#### MANUAL INSTALLATION

It is also possible to use the plugin on any page you like with a little bit of 
PHP code. Simply change the following here appropriate (most likely sidebar.php):

Change From:

    ```
    <ul>
         <?php wp_get_archives(); ?>
    </ul>
    ```

To something of the following:

    ```
        <?php
         if( function_exists('collapsArch') ) {
          collapsArch();
         } else {
          echo "<ul>\n";
          wp_get_archives();
          echo "</ul>\n";
         }
        ?>
    ```

#### 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.

## Preguntas frecuentes

### How do I change the style of the collapsing archives lists?

The collapsing archives plugin uses several ids and classes which can be
 styled
with CSS. These can be changed from the settings page. You may have to rename some
of the id statements. For example, if your sidebar is called “myawesomesidebar”,
you would rewrite the line

### sidebar li.collapsArch {list-style-type:none}

to

### myawesomesidebar li.collapsArch {list-style-type:none}

If you are using the plugin manually (i.e. inserting code into your theme),
 you
may want to replace #sidebar with #collapsArchList

### There seems to be a newline between the collapsing/expanding symbol and the

category name. How do I fix this? =

If your theme has some css that says something like

### sidebar li a {display:block}

that is the problem.
 You probably want to add a float:left to the .sym class

## Comentarios

![](https://secure.gravatar.com/avatar/21f312c362ce628db7fe7c6cfa780f5c4f8dfbc1453157d130cbad4a09b4af89?
s=60&d=retro&r=g)

### 󠀁[This broke my website, unforunately [v. 6.4.3]](https://wordpress.org/support/topic/this-broke-my-website-unforunately-v-6-4-3/)󠁿

 [YahYah24](https://profiles.wordpress.org/yahyah24/) 30 de Marzo, 2024

I just installed this one single plug-in to my website today and after doing so,
immediately, the page the plug-in was set to work on … broke, or was disabled. It
was still visible in my raw page listing, but even when I copied and pasted the 
URL directly, I still got a 404 Page Not Found error. I deleted the plug-in from
the page but that didn’t help.I had to go to the plug-in directory where I installed
it, and I had to deactivate it. The moment I did that – the page I put it on was
immediately visible again.I hope this helps the developer. This plug-in does exactly
what I need for my website. I’m supremely bummed. I’m using the Virtus theme (themeforest)
and it’s version 6.4.3. Elementor 3.19.2

![](https://secure.gravatar.com/avatar/c94ebd0ba5382a1769c3d8148d964e2e2a9cd5b1b7a969c72d5b799cf44e4ac0?
s=60&d=retro&r=g)

### 󠀁[Last update broke it](https://wordpress.org/support/topic/last-update-broke-it-2/)󠁿

 [petukhovsky](https://profiles.wordpress.org/petukhovsky/) 29 de Xaneiro, 2024

Last update has broke it. Somehow the plugin start working as collapsing categories
instead of collapsing archives.

![](https://secure.gravatar.com/avatar/83683f2e3a7992118c6e5b5120edd8a98b5a86453fdfc3025dfad592f101d275?
s=60&d=retro&r=g)

### 󠀁[Author is ignoring PHP 8.0 / 8.1 incompatibility](https://wordpress.org/support/topic/author-is-ignoring-php-8-0-8-1-incompatibility/)󠁿

 [torstensbuechereckede](https://profiles.wordpress.org/torstensbuechereckede/) 
19 de Marzo, 2022

The author has released several versions since PHP 8.0 release but just ignores 
existance of PHP 8.0 / 8.1 although that’s pretty easy to fix. I just did it by 
myself but now all the not working updates are always popping up. I don’t want to
do the fix again and again.

![](https://secure.gravatar.com/avatar/9a4545474aea6ec49cef9ee4f47e3c4f25b9beb3ae6f8eb8e9ebbfefd8ca5331?
s=60&d=retro&r=g)

### 󠀁[Great until PHP 8](https://wordpress.org/support/topic/great-until-php-8/)󠁿

 [ober0330](https://profiles.wordpress.org/ober0330/) 19 de Marzo, 2022 5 respostas

It works great except if you try to upgrade to PHP 8. The author uses {} to access
some data elements instead of the standard []. You can fix it pretty easily but 
it would also be wonderful if the plugin was updated to fix this minor thing. I’d
happily contribute a PR if the author had the code publicly somewhere (Github/etc.).

![](https://secure.gravatar.com/avatar/f9bf0caa11abb0d825f9f8cd154d190f7b052758958b0589a97673fe0ba95184?
s=60&d=retro&r=g)

### 󠀁[An error occurred](https://wordpress.org/support/topic/an-error-occurred-11/)󠁿

 [ackie00h](https://profiles.wordpress.org/ackie00h/) 15 de Marzo, 2022 4 respostas

When I activate this plugin, an error occurred below. Warning: call_user_func_array()
expects parameter 1 to be a valid callback, class ‘collapsArch’ does not have a 
method ‘enqueue_scripts’ in /home/customer/www/harupets.com/public_html/wp-includes/
class-wp-hook.php on line 307 Now I disabled it. I confirmed it in the environment
below. WordPress 5.9.2 Collapsing Archives 2.1.3 Other Plugins all disabled.

![](https://secure.gravatar.com/avatar/1ca1230c8addfa2e1d04a843b7b1b0e37d0b4537bcfe4cb964c6045345037948?
s=60&d=retro&r=g)

### 󠀁[Incompatible with PHP 8.0](https://wordpress.org/support/topic/incompatible-with-php-8-0-4/)󠁿

 [rkyburz](https://profiles.wordpress.org/rkyburz/) 30 de Setembro, 2021

The plugin worked flawlessly (sure, it feels like Blogger…) up to and including 
PHP 7.4.23. Sadly, switching to PHP 8.0 reveals a fatal flaw that breaks an entire
WP site. I have deactivated the plugin, and now my WP 5.8.1 site works just fine
with PHP 8.0.10

 [ Ler todas as 21 opinións ](https://wordpress.org/support/plugin/collapsing-archives/reviews/)

## Colaboradores e desenvolvedores

“Collapsing Archives” é un software de código aberto. As seguintes persoas colaboraron
con este plugin.

Colaboradores

 *   [ robfelty ](https://profiles.wordpress.org/robfelty/)

“Collapsing Archives” foi traducido a 2 idiomas. Grazas [aos desenvolvedores](https://translate.wordpress.org/projects/wp-plugins/collapsing-archives/contributors)
polas súas contribucións.

[Traduce “Collapsing Archives” ao teu idioma.](https://translate.wordpress.org/projects/wp-plugins/collapsing-archives)

### Interesado no desenvolvemento?

[Revisa o código](https://plugins.trac.wordpress.org/browser/collapsing-archives/),
bota unha ollada ao[repositorio SVN](https://plugins.svn.wordpress.org/collapsing-archives/),
ou subscríbete ao [log de desenvolvemento](https://plugins.trac.wordpress.org/log/collapsing-archives/)
por [RSS](https://plugins.trac.wordpress.org/log/collapsing-archives/?limit=100&mode=stop_on_copy&format=rss).

## Rexistro de cambios

#### 3.0.8 (2026.02.11)

 * Improved SQL queries to avoid possible SQL injection

#### 3.0.7 (2024.05.05)

 * Fixed some PHP warnings and removed deprecated code

#### 3.0.6 (2024.08.05)

 * Sanitizing input for block.
 * Verified works with WP 6.6
 * Updated Readme a bit

#### 3.0.5 (2023.12.07)

 * accidentally messed up tagging version 3.0.4. Calling it 3.0.5 now

#### 3.0.4 (2023.12.01)

 * Got rid of deprecated __experimentalGroup
 * Tested with WP 6.4.1

#### 3.0.3 (2023.09.11)

 * Fixed PHP warning about undefined key when changing style

#### 3.0.2 (2023.06.04)

 * Calling it stable version
 * Tested with WP 6.2.2
 * Known issue – does not work with Jetpack widget visibility settings

#### 3.0.1 (2023.04.01)

 * Fixed linkToArch option
 * Fixed taxonomy type option
 * Added SameSite attribute to cookies
 * A bit of code cleanup

#### 3.0.0 (2023.03.28)

 * Converted to Gutenberg block to be usable by full-site editing themes
 * Compatible with WP 6.2
 * Got rid of dependency on jQuery (no more animations)

#### 2.1.4 (2023.01.12)

 * Fixed a different warning about enqueuing scripts

#### 2.1.3 (2022.03.10)

 * Fixed a deprecation warning about enqueuing scripts

#### 2.1.2 (2022.03.10)

 * Fixed an issue with the full-site editor

#### 2.1.1 (2022.03.10)

 * Compatible with WP 5.9.1
 * Fixed some deprecated warnings

#### 2.1 (2021.06.18)

 * Compatible with WP 5.7
 * Incorporated a number of code improvements from my other collapsing plugins
 * Tested on WP 5.7.2
 * Updated documentation a bit
 * Added some screenshots and icons

#### 2.0.5 (2017.08.17)

 * Compatible with WP 4.8
 * Cleaned up code some to reduce warnings

#### 2.0.4 (2017.01.02)

 * Compatible with WP 4.7
 * Fixed bug with jquery compatibility
 * Removed deprecated mysql debugging info
 * Works with PHP 7

#### 2.0.3 (2015.08.12)

 * Compatible with WP 4.3

#### 2.0.2 (2014.09.24)

 * Fixed bug when expanding years but not showing month links, where the oldest 
   posts were not getting displayed

#### 2.0.1 (2014.09.05)

 * Compatible with WP 4.0

#### 2.0 (2012.04.09)

 * now using all jquery for javascript stuff
 * added accordion option
 * added option to not use cookies
 * Fixed display issues with IE
 * Easier style handling
 * Added support for custom post types

#### Older versions

 * See changelog.txt

## Meta

 *  Versión **3.0.8**
 *  Última actualización **Fai 2 meses**
 *  Instalacións activas **3.000+**
 *  Versión de WordPress ** 2.8 ou superior **
 *  Probado ata **6.9.4**
 *  Idiomas
 * [English (US)](https://wordpress.org/plugins/collapsing-archives/), [German](https://de.wordpress.org/plugins/collapsing-archives/),
   e [Spanish (Spain)](https://es.wordpress.org/plugins/collapsing-archives/).
 *  [Traduce ao teu idioma](https://translate.wordpress.org/projects/wp-plugins/collapsing-archives)
 * Etiquetas
 * [Accordion](https://gl.wordpress.org/plugins/tags/accordion/)[archives](https://gl.wordpress.org/plugins/tags/archives/)
   [collapse](https://gl.wordpress.org/plugins/tags/collapse/)[sidebar](https://gl.wordpress.org/plugins/tags/sidebar/)
   [widget](https://gl.wordpress.org/plugins/tags/widget/)
 *  [Vista avanzada](https://gl.wordpress.org/plugins/collapsing-archives/advanced/)

## Valoracións

 4.1 de 5 estrelas

 *  [  11 valoracións de 5 estrelas     ](https://wordpress.org/support/plugin/collapsing-archives/reviews/?filter=5)
 *  [  4 valoracións de 4 estrelas     ](https://wordpress.org/support/plugin/collapsing-archives/reviews/?filter=4)
 *  [  4 valoracións de 3 estrelas     ](https://wordpress.org/support/plugin/collapsing-archives/reviews/?filter=3)
 *  [  1 valoración de 2 estrelas     ](https://wordpress.org/support/plugin/collapsing-archives/reviews/?filter=2)
 *  [  1 valoración de 1 estrelas     ](https://wordpress.org/support/plugin/collapsing-archives/reviews/?filter=1)

[Engadir a miña recensión](https://wordpress.org/support/plugin/collapsing-archives/reviews/#new-post)

[Ver todas as valoracións](https://wordpress.org/support/plugin/collapsing-archives/reviews/)

## Colaboradores

 *   [ robfelty ](https://profiles.wordpress.org/robfelty/)

## Soporte

Problemas resoltos nos últimos dous meses:

     0 de 1

 [Ver o foro de soporte](https://wordpress.org/support/plugin/collapsing-archives/)

## Doar

Queres apoiar o progreso deste plugin?

 [ Dona a este plugin ](http://robfelty.com/wordpress-plugins)