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.

Installation

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>
<ul>
<?php ayb_posts(); ?>
</ul>
</div>
<?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

Examples

ayb_posts("day=30&before=&after=&showdate=0");
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.

Changelog

0.9.4

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

0.9.3

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

0.9.2

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

0.9.1

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

0.9

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

0.8

  • 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

0.7.1

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

0.7

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

0.6.1

  • Bugfix for sidebars not named „sidebar“

0.6

  • Widget-function added
  • Localization

0.5.3

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

0.5.2

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

0.5.1

  • Adjustment for MySQL-versions older than MySQL 4.1.1

0.5

  • First public beta

Download

a-year-before.zip (Version 0.9.3)

22 Gedanken zu „WordPress-Plugin: A Year Before“

  1. Hallo Ralf,
    Ich suche eine Möglichkeit das Plugin evtl. So zu verwenden wie Facebook es macht indem mich Facebook erinnert und sagt heute vor einem Jahr , heute vor zwei Jahren etc.
    also in bestimmten Intervallen .
    Ist das möglich oder gibt es so etwas?

    Über eine Antwort würde ich mich freuen !

    Antworten
    • Hi Stefan!
      Ja, das geht mit dem Plugin. Entweder im Widget z.B. bei Jahr eine „2“ für „heute vor zwei Jahren“ eintragen oder wenn du es im Theme selbst einträgst, mit ayb_posts(„anniversary=2“);

      Gruß,
      Ralf …

      Antworten
  2. 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

    WebHostingHub

    Antworten
  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?

    Antworten
  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

    Antworten
  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?

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

    Antworten
  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?

    Antworten

Schreibe einen Kommentar