WordPress-Plugin: A Year Before

With »A Year Before« you can show the titles of the articles, which were written a certain time ago. So you can show in a »historical corner«, what happend in your blog e.g. 30 days, 6 months or a year before.


Download the plugin and unzip the folder <em>a-year-before</em> in the plugin-folder of your WordPress-installation. Then activate the plugin.

If you use a theme which supports wordpress-widget, then simply go to the widget-administration and pull the widget on the sidebar.

Use the output-pattern to define the look of the found articles. Possible patterns are:

* %title% The title of the article
* %link% The link to the article
* %date% The date of the article
* %excerpt% The excerpt of the article. You can define the number of displayed characters bei appending the number like %excerpt80%, which will display 80 characters.

Example of an output-pattern: %date%: <a href="%link%">%title%<br/>%excerpt40%</a>

If you want to use the plugin by PHP-code, then open your template-file — e.g. the sidebar — where you can insert the following PHP-code:

<?php if (function_exists("ayb_posts")) { ?>
<div class="box">
<h2>Posts a year ago</h2>
<?php ayb_posts(); ?>
<?php } ?>

Configuration of the PHP-code

You can pass some parameters in this scheme
parameter1=value1&parameter2=value2&parameter3=value3 ...

You can use the following parameters

  • day : the number of days ago you want to show the articles.
  • month : the number of month ago you want to show the articles.
  • year : the number of years ago you want to show the articles.
  • before : piece of HTML to insert before the title of the articles. Default <li>
  • after: piece of HTML to insert after the title of the articles. Default </li>
  • showdate: shows the date (showdate=1) before every title or not (showdate=0)
  • dateformat : dateformat as used by PHP. Default ist the german shortform »d.m.y«
  • notfound: the text the plugin will output, if no article is found on the defined date.
  • range: number of days the plugin will search back in the future (relative to the values of day, month and year above) for an article. Meant as a „round about this day“-feature. Default 0
  • anniversary: if set to 1, the plugin will display all articles ever blogged with the same number of day and month. The parameters „day“, „month“, „year“ and „range“ will be ignored if used.
  • posts_max: maximal number of articles to be displayed


Shows the titles of the articles written 30 days ago without showing the date. The articles will not been showed as a HTML-list but simply seperated by a linebreak.

ayb_posts("month=6&day=14&notfound=Nothing blogged on this day.");
The titles of the articles written half a year and two weeks before, also showing the date . If there was no article written on that day, the output will be »Nothing blogged on this day.«

If you like CSS, you can style the date with the class ayb_date, the link of the article with the class ayb_link and the notfound-message by using the class ayb_notfound.



  • Fix (again): Sometimes other post-types (like menu-items) were shown.


  • Fix: Error with PHP 5.3 when called by PHP-statement.


  • Fix: Sometimes other post-types than posts and pages were shown


  • Minor Bugfix of possible display-error in the plugin-list in backend


  • set number of articles to be listed
  • various fixes
  • changed url to my blog – http://herrthees.de is my new blog for programming, design, journalism, etc


  • Option to show articles and/or pages
  • Option to show private and/or public articles
  • Output controlled by pattern: %link%, %title%, %date%, %excerpt% (Thanks to Marcus from themenfreund.de for the idea with the excerpt)
  • WordPress-Widget-class used (Plugin now only works with WordPress 2.8+)
  • OOP-Programming


  • fix: due an issue with the gettext-function in PHP/Apache some server will output an warning/error-message. because of that error, the translations of the plugin will not longer work, but the plugin will.


  • anniversary-mode
  • range-parameter
  • Timezone-support
  • Bugfixes


  • Bugfix for sidebars not named „sidebar“


  • Widget-function added
  • Localization


  • XHTML-Bugfix (unnecessary span)
  • Bugfix PHP 5 Error with empty function-parameter


  • Bugfix for more tolerant date-values (e.g. day > 364). Thanks to AlohaDan for hinting and testing.


  • Adjustment for MySQL-versions older than MySQL 4.1.1


  • First public beta


a-year-before.zip (Version 0.9.3)

20 Gedanken zu „WordPress-Plugin: A Year Before

  1. Hello Ralf,

    Week ago I have asked for your permission to translate your A Year Before plugin in Spanish and I didn’t hear any from you since. I hope that you will find time to provide the reply, because we believe that the translation would be of a great use. You can reply me directly on andrewk@webhostinghub.com

    All the best,

    Andrew Kurtis


    1. Sorry, i stuck in work.
      Certainly you may translate the plugin, the pot-file is included in the zip-file of the plugin at wordpress.org. Send me the po/mo-files and i will include them in the next version.

  2. Hi Ralf,

    My name is Andrew, I am with WebHostingHub . We would like to translate your A Year Before plugin that we found at http://herrthees.de/2012/09/15/wordpress-plugin-a-year-before/ to Spanish language, no charge of course, to
    help people from Hispanic community better manage their websites.
    Would that be ok with you? You can reply me directly on my email.

    I hope I’ll hear from you soon.

    Kind regards

    Andrew Kurtis

  3. Great plugin, but I’m encountering the occasional error. For example, if you look at http://www.cnyradio.com today, you’ll see the plugin is used in one of my sidebar widgets. There are several blank entries. There are also entries for menu items which must have been created on this date… but (a) the links don’t work and (b) these are menu items, not articles — so they shouldn’t be appearing anyway. Any chance for a bug fix on this?

  4. Hallo! Super Plugin
    Habe den Jahrestag Modus aktiviert. Kann ich im Widget irgendwie einstellen, dass range Funktion möglich ist. Ich möchte Beiträge die vor 1,2,3 Jahren usw angezeigt werden und eine Woche im voraus schon gelistet sind. Danke

  5. Hi, ich hab auch das Problem, dass keine Beiträge mehr gefunden werden, obwohl es die definitiv geben müsste. Kannst du mal ein Update mit nem Fix rausbringen, bittebittebitte?

    1. So, ich konnte den Fehler nun bei mir beheben, indem ich das Widget aus der Sidebar entfernt und dann wieder hinzugefügt habe… self-repairing 😉

  6. Das Plugin verursachte eine Fehlermeldung 1 Zeichen unerwartete Ausgabe während der
    Aktivierung. Sollte du Fehlermeldungen wie “headers already sent”, Probleme mit
    der Syndizierung der Feeds oder andere Fehler erhalten, versuche das Plugin zu
    deaktivieren oder zu löschen.

    und hier der php-fehler

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/…/…/html/wp-content/plugins/a-year-before/ayb_posts.php:733) in /home/content/…/…/html/wp-includes/pluggable.php on line 881

    Es läuft also leider nicht mit der aktuellen WP-Version.

    1. Kannst du mir sagen, wie und mit welchen Einstellungen du das Plugin verwendest? Denn bei vielen Blogs funktioniert es, du bist die erste, von der ich von einem solchen Fehler erfahre.

  7. Leider wird seit dem neuesten Update der vor einem Jahr geschriebene Artikel angezeigt, allerdings nicht mehr verlinkt. Ich nnutze das Widget und möchte nur sehr ungern auf dieses klasse Plugin verzichten. Vielleicht kannst Du ja helfen?

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.