Herr Thees

Journalismus, Bloggen, Webdesign und neue Medien

A Year Before in Aptana Studio

WordPress-Plugin: A Year Before

| 20 Kommentare

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 – http://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)

Kategorien: Allgemein, Programmierung | Schlagwörter: , , , | Permalink

  • Andrew Kurtis

    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

    • http://herrthees.de/ Ralf Thees

      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.

      • Andrew Kurtis

        Hi Ralf,

        Thanks for your reply.
        Please can you email me at andrewk@webhostinghub.com and leave me your mail address so that I can send it back when I finish the translation?

        Thank!
        Andrew Kurtis

  • Andrew Kurtis

    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
    WebHostingHub

  • Peter

    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?

  • Woflgang Sekora

    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

  • Kerstin

    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?

    • http://herrthees.de Ralf Thees

      Ich kümmere mich darum. In welchem Blog setzt du das Plugin ein?

    • Kerstin

      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 ;-)

      • http://herrthees.de/ Ralf Thees

        Hab ich das nicht toll programmiert! ;) Falls es doch wieder zickt, gib mir Bescheid!

  • basti

    schade -seit dem letzten update geht es nicht mehr…

  • Ruth

    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.

    • http://herrthees.de/ Ralf Thees

      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.

    • http://herrthees.de/ Ralf Thees

      Magst du dir mal die Entwickler-Version 0.9.1 herunterladen und installieren und schauen, ob der Fehler dann noch auftritt?
      http://downloads.wordpress.org/plugin/a-year-before.zip

  • http://www.facebook.com/thorloewenherz Thor Löwenherz

    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?

    • http://herrthees.de/ Ralf Thees

      Wie sieht denn dein Ausgabemuster im Widget aus?

      • http://www.facebook.com/thorloewenherz Thor Löwenherz

        Hallo Ralf, dachte, ich habe es mit §%title%” in den Griff bekommen. Leider wird der Link jetzt falsch ausgegeben: http://thorbloggt.de/“http://thorbloggt.de/2011/10/sommer-im-herbst”. Also irgendwie doppelt gemoppelt.

        • http://www.facebook.com/thorloewenherz Thor Löwenherz

          Danke, habe es gefunden. Einfach die ” weglassen. Jetzt funktioniert es wieder einwandfrei und ich muss nicht auf das klasse Plugin verzichten.

  • Pingback: Wordpress-Plugin: A Year Before » Würzblog » blog, plugin, software, würzblog, wordpress