When I started this blog with WordPress, I developed a small piece of code to display list of archives in a compact way. The list was displayed by grouping the posts by year and then by month, according to a pivot year. Some of you ask me to include this code into a plugin.
EG-Archives provides a widget and a template tag, and allows to display the archives in this mixed mode, between annual and monthly frequency.


EG-Archives provides a widget (and a template tag) to display archives in yearly mode, AND monthly, according a specified pivot date.
The standard archives widget doesn’t accept a lot of parameters. You can just specify

  • a title,
  • if you want to display posts count or not.

With the EG-Archives widget, you can choose

  • the title,
  • the format of the list (simple or dropdown list),
  • the type: Yearly, Monthly, …

A specific type is added: the « mixed Yearly/monthly » type.
With this type, you can display list of archives in yearly mode before a specified year, and in monthly mode after this specified date. This type allows to shorten list, and is very useful if you don’t publish too many posts per year.

Liste des archives
Archives list


  1. The plugin is available for download on the WordPress repository,
  2. Download the file ``, and uncompress it,
  3. Upload the resulting files to a folder in `../wp-content/plugins/`,
  4. Activate EG-Archives through the ‘Plugins’ menu in WordPress,
  5. The plugin is ready to be used,

The plugin is now ready to be used.
You can also use the WordPress 2.7 features, and install the plugin directly from the WordPress interface.


EG-Archives adds a widget, and a template tag.


  • Go to the Appearence / Widgets menu,
  • Active the widget named: EG-Archives,
  • Configure it, through the widget menu.
Configuration du widget
Widget configuration

Template tag

You can display the archives list, anywhere in your templates, with the function: eg_get_archives('arguments')
Arguments are the same than the standard WordPress function `wp_get_archives`.

  • type (string) The type of archive list to display. Valid values: yearly, monthly, daily, weekly, postbypost. Default is monthly,
  • limit (integer) Number of archives to get. Default is no limit,
  • format(string) Format for the archive list. Valid values:
    • html – In HTML list (ul/li) tags and before and after strings. This is the default,
    • option – In select (select/option) or dropdown option () tags,
    • link – Within link (link) tags,
    • custom – Custom list using the before and after strings.
  • before (string) Text to place before the link when using the html or custom for format option. There is no default,
  • after (string) Text to place after the link when using the html or custom for format option. There is no default,
  • show_post_count (boolean) Display number of posts in an archive (1 – true) or do not (0 – false). For use with all type except ‘postbypost’. Defaults to 0,
  • echo (boolean) Display the output (1 – true) or return it (0 – false). Defaults to 1.

eg_get_archives accept an additional argument:

  • pivot (integer) The « pivot » year. Before the pivot, archives are listed i yearly mode, after archives are listed in monthly mode. Default: current year (currently 2009)

Frequently Asked Questions


14 thoughts on “EG-Archives”

  1. Hi,
    I have this widget, however I have it on Post-by-post and it extends way of my webpage. Is there a way to lessen the width of EG Archives?

  2. Apparently, if there is a folder with the same name as the archive file, the archive page will not display. So, I just need to rename my folders. That will be a tedious process though, since the static files in those folders are linked to pages throughout the website. Each of those pages needs to be corrected.

  3. Thank you for such a quick response.

    The links generated in the archive list are to the monthly archive: for example. However, for the 2008 link it is to alone. Since that is also a folder in our website, I am getting a directory listing rather than a WP archive page.

    By adding IndexIgnore to my .htaccess I can stop it listing the contents of the directory, but it still does not display an archive page.

    My theme is an adaptation of the WP classic theme, with all of the same files and filenames. There is no archive template page. I have tried running the classic and the default theme, the yearly archive page still does not appear.

    Thank you for any help that you can give me.

  4. Thank you, I think this plugin will be what I need. I probably should ask my question elsewhere, but I don’t know how to ask it.

    My problem is with the archives pages that are generated. When I installed your plugin, and added the template tag to the sidebar, the 2008 link takes the user to a directory list of my 2008 folder. The items in this folder are not archives. Instead, I want the user to get a yearly archive page. This is obviously a template issue and not a plugin problem, so if you could point me in the right direction I would appreciate it.

  5. Il faudrait m’envoyer le theme (contenu du repertoire turuncu-gemi), parce que manifestement, le plugin et le theme ne sont pas compatibles …
    Avec les fichiers du theme je pourrai analyser ce qu’il se passe exactement.

  6. Bonjour!
    Ce widget me donne une fonction dont j’ai besoin — merci pour l’avoir créé. Étrange qu’il ne soit pas automatique chez WordPress. Cependant, je n’arrive pas à le faire fonctionner. Voici l’erreur que je reçois:

    Fatal error: Call to undefined function simpleyearlyarchive() in /home/******/public_html/*****/wp-content/themes/turuncu-gemi/archive.php on line 23


  7. @fruity:
    I don’t have the same display with the same options.
    Could you try again with the 1.0.1, and send me the html code of your page if the bug is still exist.

  8. Post counts issue above. For example, I chose Yearly/Monthly + 2009 pivot year, got displayed as:
    January 2009 (1) CORRECT
    2008 (1) INCORRECT (should have been 7)
    2007 (2) INCORRECT (should be 47)
    2006 (10) INCORRECT (should be 55)

  9. 2 bugs:

    1. When I display years as drop-down, the years display on top of the drop-down (nothing appears INSIDE the drop-down). Looks like this, example:
    2009, 2008, 2007, 2006
    [drop-down box]

    2. The post counts are way off (not accurate).

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.