Title: A Year Before
Author: Ralf
Published: <strong>2007 年 3 月 27 日</strong>
Last modified: 2019 年 5 月 19 日

---

搜尋外掛

這個外掛**並未在最新的 3 個 WordPress 主要版本上進行測試**。開發者可能不再對這個
外掛進行維護或提供技術支援，並可能會與更新版本的 WordPress 產生使用上的相容性問題。

![](https://s.w.org/plugins/geopattern-icon/a-year-before.svg)

# A Year Before

 由 [Ralf](https://profiles.wordpress.org/wuerzblog/) 開發

[下載](https://downloads.wordpress.org/plugin/a-year-before.1.0.3.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/a-year-before/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/a-year-before/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/a-year-before/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/a-year-before/#developers)

 [技術支援](https://wordpress.org/support/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. You also can use the “anniversary-
mode”, which will display all the posts through the years, which were written on
this day and month.

You can use it as a wordpress-widget or put it in your theme as a php-function with
parameters.

### Configuration

#### Using the widget

Just click on the configuration-button of the widget an use the selfexplaining popup-
dialog.
 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.
 * %thumbnail% The featured image of the article.

#### Not using the widget

You can call the plugin with a PHP-statement in a WordPress-Theme and 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
   >`
 * 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
 * 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.
 * 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.
 * private: show private posts? 0: only public posts 1: private and public posts
   2: only private posts. Default 0
 * showpages: show pages? 0: No, 1: Yes. Default 0
 * posts_max: number of articles to be shown. 0 means ‘all’. Default 0

#### Examples

    ```
    ayb_posts("day=30&before=&after=<br />&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`
<br />`.

    ```
    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.«

    ```
    ayb_posts("range=14&dateformat=y-m-d");
    ```

Looks up a year back for written articles. If none are found, the plugin will check
the next 14 days in the future. If a article is found on some of this days, all 
articles of this day will be listed with a “year-month-day”-format.

    ```
    ayb_posts("anniversary=1");
    ```

Shows the title of all posts, which were posted on the same day in the same month,
independend of the year. E.g. on chistmas day you will see all posts, which are 
posted on december 24th since the blog was started.

### Styling

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

### Uninstall

Deactivate the plugin, then select “delete” in the plugin-panel. The files _and_
the options of this plugin will be deleted. Thank you for using “a year before”.
😉

## 安裝方式

#### Using widgets in wordpress

 1. Download the plugin and put the directory “a-year-before” in the plugin-folder 
    of your wordpress-installation.
 2. Then activate the plugin.
 3. Go “Themes/Widgets” and pull the widget in the sidebar. Ready to go! Configure 
    it, if you want.

#### Not using widgets in wordpress

 1. Download the plugin and put the file ayb_posts.php in the plugin-folder of your
    WordPress-installation.
 2. Then activate the plugin.
 3. In your template – e.g. the sidebar – you can insert the following PHP-code:
 4.     ```
        <?php if (function_exists("ayb_posts")) { ?>
        <div class="einjahr">
        <h2>Vor einem Jahr</h2>
          <ul>
             <?php ayb_posts('day=7'); ?>
          </ul>
        </div>
        <?php } ?>
        ```
    

## 使用者評論

![](https://secure.gravatar.com/avatar/7be0487b429229544c79f1493b07e23aa1a14704a9784c96b4759daf94936f9a?
s=60&d=retro&r=g)

### 󠀁[Genau richtig!](https://wordpress.org/support/topic/genau-richtig-2/)󠁿

 [HDS home](https://profiles.wordpress.org/hds-home/) 2019 年 5 月 20 日

Danke für die Anpassungen und Optimierungen mit der Version 1.0.3 – genau das habe
ich gebraucht!

![](https://secure.gravatar.com/avatar/ca1682fc78899ede01e09fabd1237e769b08dd1e421e082827c6e0d35e627f67?
s=60&d=retro&r=g)

### 󠀁[An essential plugin for diary-like blogs](https://wordpress.org/support/topic/an-essential-plugin-for-diary-like-blogs/)󠁿

 [sonofbruce](https://profiles.wordpress.org/sonofbruce/) 2017 年 11 月 5 日

Works like a charm. My daily microblog would be so much less interesting without
it.

![](https://secure.gravatar.com/avatar/dee29cff117aa28df66b38f1cc55c77e04838962060fc44e915afc1747e38092?
s=60&d=retro&r=g)

### 󠀁[patch for php 5.6 compatibility](https://wordpress.org/support/topic/patch-for-php-5-6-compatibility/)󠁿

 [zuHause](https://profiles.wordpress.org/zuhause/) 2017 年 7 月 18 日

I like the plugin: does what I need it to do. Nevertheless my website needs an update,
PHP 5.3 is more or less an ‘ancient custom’… @@ -358,7 +358,7 @@ function ayb_posts(
$ayb_para = ”) { $ayb_parameter = explode(‘&’, $ayb_para); foreach ($ayb_parameter
as $ayb_temp) { – $b = preg_split(‘=’, $ayb_temp); + $b = split(‘=’, $ayb_temp);
$instance[$b[0]] = $b[1]; }//$ayb_parameter as $ayb_temp $widget_arr = array();

![](https://secure.gravatar.com/avatar/5252968bcd4596edb032502c74f6a22981c92798b6fa822e49aafd76ac72b166?
s=60&d=retro&r=g)

### 󠀁[Sehr leicht modifizierbar, aber ein wenig buggy](https://wordpress.org/support/topic/sehr-leicht-modifizierbar-aber-ein-wenig-buggy/)󠁿

 [mrmeeeseeks](https://profiles.wordpress.org/mrmeeeseeks/) 2016 年 9 月 3 日

Das Plugin ist relativ leicht installierbar, gut anpassbar (aber auch nur wenn man
die Anleitung auf der Webseite des Autors anguckt) und funktioniert auch. Leider
kann man die Jahreszahlen nicht ausstellen (weder über PHP, noch über Widget). Sehr
häufig wird das Datum eines Ereignisses mehrmals aufgelistet.

 [ 閱讀全部 5 則使用者評論 ](https://wordpress.org/support/plugin/a-year-before/reviews/)

## 參與者及開發者

以下人員參與了開源軟體〈A Year Before〉的開發相關工作。

參與者

 *   [ Ralf ](https://profiles.wordpress.org/wuerzblog/)

[將〈A Year Before〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/a-year-before)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/a-year-before/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/a-year-before/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/a-year-before/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/a-year-before/)。

## 變更記錄

#### 1.0

Add: #thumbnail’-pattern to show featured imagages of articles

#### 0.9.5

Fixed some PHP-Notices (Patch by lostfocus https://gist.github.com/lostfocus/a68f0689d20feceb7911)

#### 0.9.4

Fix (again): Again sometimes other post-types (like menu-items) were shown.

#### 0.9.3

Fix: Error with PHP 5.3 when called by PHP-statement. Thanks to www.hisky.de for
reporting the error

#### 0.9.2

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

#### 0.9.1

 * Fix possible display-error in plugin-list

#### 0.9

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

#### 0.8

 * show pages or not
 * public, private or both articles can be shown
 * widget output can be edited with patterns %link%, %title%, %date%, %excerpt% (
   thanks to Marcus from themenfreund.de for the excerpt-idea)
 * fixed bugs, i.e. timezone-bug
 * use of wordpress’s widget-class (plugin works now wordpress 2.8+ only)
 * OOP-programming

#### 0.7beta11

 * added uninstall-feature for wordpress 2.7+. if the plugin is deleted, the options
   of this plugin will be deleted in the wordpress-database.

#### 0.7beta10

 * fix: check if functions are already declared (for multiple use of the plugin)

#### 0.7beta9

 * unknown changes

#### 0.7beta8

 * kicked out debug-messages … =:-)

#### 0.7beta7

 * bit of cleanup
 * make date-calculation gmt-sensitive. the wordpress-timezone-option is used now.
   should fix problems, where articles, written a few hours (the timezone-difference)
   before or after midnight are not displayed correctly.
 * some minor bugfixes

#### 0.7beta4

 * adding anniversary-mode. if anniversary=0, all articles matching the current 
   day and the current month will be show, regardless of which year (beside the 
   actual year of course). all settings of day, month, year and range will be ignored.

#### 0.7beta3

 * using the wordpress timezone-offset

#### 0.7beta2

 * fixed: plugin generated invalid XHTML in some cases

#### 0.7beta1

 * added range-parameter. you can use e.g. year=1&range=7 if you want to look back
   one year for articles. if no article is found on this day, the plugin will look
   up to 7 days back and lists the articles of the day the first article was found.

#### 0.6.1

 * Fix for sidebars not named ‘sidebar’

#### 0.6

 * Minor clean-up

#### 0.6beta4

 * Fixed finding localization files

#### 0.6beta3

 * Localization
 * Added german language-file

#### 0.6beta2

 * Make sure the non-widget-use of the plugin

#### 0.6beta1

 * ‘Widgetize’ the plugin

#### 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

## 中繼資料

 *  版本 **1.0.3**
 *  最後更新 **7 年前**
 *  啟用安裝數 **40+**
 *  WordPress 版本需求 ** 2.8.0 或更新版本 **
 *  已測試相容的 WordPress 版本 **5.2.24**
 *  語言
 * [English (US)](https://wordpress.org/plugins/a-year-before/)
 * 標籤:
 * [date](https://tw.wordpress.org/plugins/tags/date/)[history](https://tw.wordpress.org/plugins/tags/history/)
   [posts](https://tw.wordpress.org/plugins/tags/posts/)[time](https://tw.wordpress.org/plugins/tags/time/)
   [widget](https://tw.wordpress.org/plugins/tags/widget/)
 *  [進階檢視](https://tw.wordpress.org/plugins/a-year-before/advanced/)

## 評分

 4.2 星，滿分為 5 星

 *  [  2 個 5 星使用者評論     ](https://wordpress.org/support/plugin/a-year-before/reviews/?filter=5)
 *  [  2 個 4 星使用者評論     ](https://wordpress.org/support/plugin/a-year-before/reviews/?filter=4)
 *  [  1 個 3 星使用者評論     ](https://wordpress.org/support/plugin/a-year-before/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/a-year-before/reviews/?filter=2)
 *  [  0 個 1 星使用者評論     ](https://wordpress.org/support/plugin/a-year-before/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/a-year-before/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/a-year-before/reviews/)

## 參與者

 *   [ Ralf ](https://profiles.wordpress.org/wuerzblog/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/a-year-before/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](http://flattr.com/thing/313825/Wordpress-Plugin-A-Year-Before)