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

Use the Attachment Image!

外掛說明

Use the Attachment Image! allows the first attachment image associated with a post to be displayed nearly anywhere on a blog, simply by adding a special function to a loop. This plugin is a perfect compliment for magazine themes.

This plugin can include images of nearly any size, simply by using the included <?php use_the_attachment_image(); ?> function. See the installation page for more details regarding usage.

安裝方式

To utilize this plugin, you will first need to upload use_attachment_image.php to the /wp-content/plugins/ directory on your web server; and activate the plugin through the ‘Plugins’ menu in WordPress.

Next, place <?php use_the_attachment_image() ?> (will include a link to the post), or <?php use_the_attachment_image_nolink() ?> (will NOT include a link to the post) in your template to include a thumbnail of the first attachment image. Note the function must be inside of a WordPress loop.

By default, this function will include a thumbnail image. To include images of different sizes, use the respective functions below. You may also use <?php use_the_attachment_image_nolink() ?> in place of <?php use_the_attachment_image() ?> here.

Thumbnail <?php use_the_attachment_image('thumbnail'); ?>
Medium <?php use_the_attachment_image('medium'); ?></p>
Large <?php use_the_attachment_image('large'); ?></p>
Full <?php use_the_attachment_image('full'); ?>
20 px <?php use_the_attachment_image(array(20,20)); ?>
Feel free to replace 20px with another specific size to best meet your needs. Note that WordPress will scale a larger image down to give you the size you desire here.

It is possible to include a thumbnail image from each post in your RSS feed. To do this, simply add this code to your theme’s functions.php file. From cd harrison.

<?php
if (function_exists('use_the_attachment_image')) {
    function insertAttachmentRSS($content) {
        global $post;
        { $content = use_the_attachment_image() . $content; }
        return $content;
    }
    add_filter('the_excerpt_rss', 'insertAttachmentRSS');
    add_filter('the_content_feed', 'insertAttachmentRSS');
}
?>

See an example of how this plugin can be used.

使用者評論

這個外掛目前沒有任何使用者評論。

參與者及開發者

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

參與者

將〈Use the Attachment Image!〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

1.02

  • The code that includes the post image in an RSS feed was taken out of the plugin and moved to the readme file; as it did not previously work when it was included in a separate file from the plugin file as was suggested in the plugin instructions.

1.01

  • Fixed the function name in the documentation. In a few cases, a function that did not exist was referenced. Thanks, Matias for the report. The actual plugin was not changed.

1.0

  • Initial release.