Title: Image Refresh
Author: Micah Wood
Published: <strong>2012 年 11 月 11 日</strong>
Last modified: 2024 年 12 月 1 日

---

搜尋外掛

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

![](https://ps.w.org/mpress-image-refresh/assets/icon-256x256.png?rev=3200416)

# Image Refresh

 由 [Micah Wood](https://profiles.wordpress.org/wpscholar/) 開發

[下載](https://downloads.wordpress.org/plugin/mpress-image-refresh.2.3.1.zip)

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

 [技術支援](https://wordpress.org/support/plugin/mpress-image-refresh/)

## 外掛說明

The **Image Refresh** plugin allows you to randomly display a different image on
every page load.

#### Why?

Many people like to vary up the images on their site just to keep things fresh. 
Loading a new image every time someone visits your homepage is something that should
be simple, right? Alas, people resort to using plugins that are not meant for this
purpose and end up sacrificing performance for the sake of a fresh look. Well, my
friend, the search has ended. This plugin does nothing more, and nothing less than
load that fresh image where you need it. To top it all off, we do it in a way that
won’t slow your site down.

#### How?

Using this plugin is simple:

 1. Install the plugin
 2. Activate the plugin
 3. On the page or post where you want to have an image refresh, just click on the ‘
    Add Media’ button, upload as many images as you like, click ‘Save Changes’ and 
    exit the media uploader.
 4. Add the `[mpress_image_refresh]` shortcode where you want your image to appear.
 5. Save your changes.

#### Features

 * Works with custom post types
 * No settings page, just an easy way for you to add fresh images to your site
 * Clean, well written code that won’t bog down your site

## 安裝方式

#### Prerequisites

If you don’t meet the below requirements, I highly recommend you upgrade your WordPress
install or move to a web host
 that supports a more recent version of PHP.

 * Requires WordPress version 3.2 or greater
 * Requires PHP version 5 or greater ( PHP version 5.2.4 is required to run WordPress
   version 3.2 )

#### The Easy Way

 1. In your WordPress admin, go to ‘Plugins’ and then click on ‘Add New’.
 2. In the search box, type in ‘mPress Image Refresh’ and hit enter. This plugin should
    be the first and likely the only result.
 3. Click on the ‘Install’ link.
 4. Once installed, click the ‘Activate this plugin’ link.

#### The Hard Way

 1. Download the .zip file containing the plugin.
 2. Upload the file into your `/wp-content/plugins/` directory and unzip
 3. Find the plugin in the WordPress admin on the ‘Plugins’ page and click ‘Activate’

#### Usage Instructions

Once the plugin is installed and activated, go to any page or post where you want
to have a fresh image display on each page load. Just above the content editing 
area, click on the ‘Add Media’ icon to bring up the media uploader. Upload one or
more images and click ‘Save Changes’ before exiting out of the popup window. Add
the `[mpress_image_refresh]` shortcode in the content area where you want your image
to appear. Save your changes and check out the results!

## 常見問題集

The `[mpress_image_refresh]` shortcode supports a few attributes to give you more
control over the results:

 * **attachment** – You can pass in a comma separated list of image IDs if you want
   to directly specify a set of images to use. Using this attribute invalidates 
   the `post_id` and `not` attributes. Example: `[mpress_image_refresh attachment
   ="19, 37, 940"]` Optionally, you can also have the shortcode randomly pull from
   a subset using this syntax: `[mpress_image_refresh attachment="19,37,940|453|
   98"]`
 * **post_id** – You can pass in the post ID to pull attached images from. If your
   images are attached to another post, just provide the ID of that post and we 
   will pull those images instead. Example: `[mpress_image_refresh post_id="19"]`
 * **size** – By default, we use the ‘large’ image size defined by WordPress. However,
   you can use the other built-in image sizes ( ‘thumbnail’, ‘medium’, ‘full’ ) 
   or any custom image sizes you have defined. Example: `[mpress_image_refresh size
   ="full"]`
 * **class** – Set a custom class on your image using this attribute so you can 
   apply custom styling. Example: `[mpress_image_refresh class="fresh-image"]`
 * **not** – Sometimes you have an image within the page content, and as such it
   is automatically attached to the page or post. You probably don’t want these 
   images to be used as one of your random images, so just pass in the ID of those
   images to keep those from showing up. Example: `[mpress_image_refresh not="2310,
   2319"]`
 * **caption** – You can pass in ‘true’ or ‘false’. If set to ‘true’, then the caption
   will be displayed below the image. Example: `[mpress_image_refresh attachment
   ="5,7,9" caption="true"]`.

Keep in mind that any of these attributes can be combined as needed. Example: `[
mpress_image_refresh post_id="19" size="full" not="2310"]`. Also, keep in mind that
the shortcode can be used in text widgets. However, you will probably want to define
the **post_id** attribute when using the shortcode in a text widget.

### Actions and Filters

 * `mpress_image_refresh-attachment_id` — Filter the attachment ID selected for 
   display. Parsed shortcode attributes are provided as an additional parameter 
   to the callback function.
 * `mpress_image_refresh-image_atts` — Filter the image attributes. The attachment
   post object and parsed shortcode attributes are provided as additional parameters
   to the callback function.
 * `mpress_image_refresh-markup` — Filter the markup surrounding the image. The 
   attachment post object and parsed shortcode attributes are provided as additional
   parameters to the callback function.
 * `mpress_image_refresh-image_html` — Filter removed in version 2.0. Use `mpress_image_refresh-
   markup` filter instead.

## 使用者評論

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

### 󠀁[Works beautifully!](https://wordpress.org/support/topic/works-beautifully-197/)󠁿

 [Lightwing](https://profiles.wordpress.org/lightwing/) 2026 年 2 月 4 日

I used to use an image randomizer when I hand-coded websites and was delighted to
discover this plugin gem that provides the same functionality. Light weight method
of providing a fresh view to each visitor.

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

### 󠀁[Unclear documentation](https://wordpress.org/support/topic/unclear-documentation-2/)󠁿

 [webstpro](https://profiles.wordpress.org/webstpro/) 2023 年 10 月 20 日

I followed the limited documentation. The result is that it randomly shows ALL images
in the media library.. There seems to be no way to select which images should be
shown.

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

### 󠀁[Great Plugin](https://wordpress.org/support/topic/great-plugin-33479/)󠁿

 [Marcel de Korte](https://profiles.wordpress.org/dekortemarcel/) 2022 年 2 月 20
日

Works great and is easy to work with. Hopefully the creator will keep this plugin
update 🙂

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

### 󠀁[smart because simple](https://wordpress.org/support/topic/smart-because-simple/)󠁿

 [Anonymous User 14293447](https://profiles.wordpress.org/anonymized-14293447/) 
2020 年 12 月 18 日

…the alternative would be using jquery, not everyone can code. Yet, I’m not sure
its fully working because I’m using it inside WpBakery and the “size” attribute 
is not working. That said, page builders suck therefore can cause conflicts everywhere….
or can it be the plugin?

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

### 󠀁[Very helpful plugin](https://wordpress.org/support/topic/very-helpful-plugin-175/)󠁿

 [stvictor](https://profiles.wordpress.org/stvictor/) 2018 年 9 月 7 日 1 則留言

Thank you!

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

### 󠀁[Geat Plugin!](https://wordpress.org/support/topic/geat-plugin-6/)󠁿

 [terezavyhlidal](https://profiles.wordpress.org/terezavyhlidal/) 2017 年 2 月 17
日 1 則留言

This plugin solved my problem. Works great and its simple.

 [ 閱讀全部 18 則使用者評論 ](https://wordpress.org/support/plugin/mpress-image-refresh/reviews/)

## 參與者及開發者

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

參與者

 *   [ Micah Wood ](https://profiles.wordpress.org/wpscholar/)

[將〈Image Refresh〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/mpress-image-refresh)

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

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

## 變更記錄

#### 2.3.1

 * General maintenance

#### 2.3

 * Update compatibility with WP 6.5
 * Add ability to randomly select an attachment ID from a subset.

#### 2.2.1

 * Fix fatal error in WP 6.0.1

#### 2.2

 * Added ability to specify a link URL for images.

#### 2.1.1

 * Fixed bug where no image was shown on 404 pages when explicitly providing a collection
   of attachment IDs.

#### 2.1

 * Fix to allow a ‘full’ image size to be used.
 * Added note to help messages letting the user know only logged in users with the
   ability to edit the shortcode can see the notification.

#### 2.0

 * Added helpful error messages for content editors when there is an issue with 
   the shortcode implementation.
 * Updated plugin to provide a number of new filters for developers.
 * Updated plugin to make it translatable.
 * Tested in WordPress version 4.7.2

#### 1.0

 * Tested in WordPress version 4.5.2

#### 0.4

 * Updated plugin to be more friendly with WPEngine’s WordPress hosting environment.

#### 0.3

 * Added ability to display image captions, if desired.
 * Added filter `mpress_image_refresh-image_html` to allow for HTML customizations.
 * Updated plugin ‘Tested Up To’ tag to WordPress version 4.1

#### 0.2

 * Updated plugin ‘Tested Up To’ tag to WordPress version 4.0
 * Added ‘attachment’ shortcode attribute for users who want to specify a set of
   images directly from the Media Library.

#### 0.1

 * Initial commit

## 中繼資料

 *  版本 **2.3.1**
 *  最後更新 **2 年前**
 *  啟用安裝數 **1,000+**
 *  WordPress 版本需求 ** 4.5 或更新版本 **
 *  已測試相容的 WordPress 版本 **6.7.5**
 *  PHP 版本需求 ** 5.4 或更新版本 **
 *  語言
 * [English (US)](https://wordpress.org/plugins/mpress-image-refresh/)
 * 標籤:
 * [image refresh](https://tw.wordpress.org/plugins/tags/image-refresh/)[image reload](https://tw.wordpress.org/plugins/tags/image-reload/)
   [image rotation](https://tw.wordpress.org/plugins/tags/image-rotation/)[random image](https://tw.wordpress.org/plugins/tags/random-image/)
 *  [進階檢視](https://tw.wordpress.org/plugins/mpress-image-refresh/advanced/)

## 評分

 4.9 星，滿分為 5 星

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

[Your review](https://wordpress.org/support/plugin/mpress-image-refresh/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/mpress-image-refresh/reviews/)

## 參與者

 *   [ Micah Wood ](https://profiles.wordpress.org/wpscholar/)

## 技術支援

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

 [檢視技術支援論壇](https://wordpress.org/support/plugin/mpress-image-refresh/)

## 贊助

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

 [ 贊助這個外掛 ](https://www.paypal.me/wpscholar)