Allgemein,  Programmierung

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)

Pages: 1 2

Ralf Thees: Blogger, Podcaster, freier Journalist, Webentwickler, Bastler, experimenteller Musiker, Hobby-Astronom, Mensch.

22 Comments

Schreibe einen Kommentar

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