Title: WP Gallery Image Shortcode
Author: davidpotter
Published: <strong>2009 年 11 月 17 日</strong>
Last modified: 2009 年 11 月 24 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/wpgalleryimage-shortcode.svg)

# WP Gallery Image Shortcode

 作者：[davidpotter](https://profiles.wordpress.org/davidpotter/)

[下载](https://downloads.wordpress.org/plugin/wpgalleryimage-shortcode.1.1.zip)

 * [详情](https://cn.wordpress.org/plugins/wpgalleryimage-shortcode/#description)
 * [评价](https://cn.wordpress.org/plugins/wpgalleryimage-shortcode/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/wpgalleryimage-shortcode/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/wpgalleryimage-shortcode/#developers)

 [支持](https://wordpress.org/support/plugin/wpgalleryimage-shortcode/)

## 描述

Lets you add an image to a post or page from the WordPress gallery on your site 
using a shortcode. Simply add the wppgalleryimage shortcode and specify the image
you want to add by name or ID.

When you insert an image using the built-in WordPress editor, the full URL to the
image on your site is inserted into the page or post. Using the shortcode, all you
need to specify is the name or ID of the image and the URL is generated automatically.

When an image is uploaded to the gallery, the file is stored under wp-content/uploads
and metadata about the image is stored in the `wp_posts` table with a `post_type`
of `attachment`. The image is added to post or page within a `<div>` tag that specifies
the `wpgalleryimage_shortcode` class, which allows you to define a style for all
images added by the shortcode.

#### Parameters

 * **id** – The ID of the image in the `wp_posts` table.
 * **name** – The name of the image from the `post_name` field in the `wp_posts`
   table.
    The name must match exactly.
 * **title** – The titlee of the image from the `post_title` field in the `wp_posts`
   table.
    The title must match exactly.
 * **size** – The size of the image.
    This value is passed to the [`wp_get_attachment_image`](https://codex.wordpress.org/Function_Reference/wp_get_attachment_image)
   function. Valid values include:
    - `thumbnail` (default)
    - `medium`
    - `large`
    - `full`
 * **width** and **height** – The width and height of the image to display.
    The
   most appropriate image file will be used to display the image. Both must be specified
   or they will be ignored. If these parameters are specified, the **size** parameter
   is ignored.
 * **float** – How to float the image on the page. Valid values include:
    - `none` (default)
    - `left`
    - `right`
 * **link** – The URL to link to when the image is clicked on. You can also specify`
   full` to link to the full-size image.
 * **padding**, **paddingtop**, **paddingright**, **paddingbottom**, **paddingleft**–
   The amount of padding around the image.
    If floating left, defaults to `10px`
   on the right. If floating right, defaults to `10px` on the left.

#### Examples

> [wpgalleryimage id=”19″]
> [wpgalleryimage name=”my-logo”]
> [wpgalleryimage title=”My Logo”]
> [wpgalleryimage name=”my-logo” size=”medium”]
> [wpgalleryimage name=”my-logo” width=”100″ height=”100″]
> [wpgalleryimage name=”my-logo” float=”right”]
> [wpgalleryimage name=”my-logo” link=”full”]
> [wpgalleryimage name=”my-logo” link=”http://www.example.com/”]
> [wpgalleryimage name=”my-logo” paddingbottom=”10px”]

## 安装

 1. Download the `wpgalleryimage-shortcode.zip` file.
 2. Unzip the zip file and copy the contents to a folder below `/wp-content/plugins`.
 3. Activate the plugin through the ‘Plugins’ menu in WordPress.
 4. Place the `[wpgalleryimage]` shortcode in your posts and pages.

## 常见问题

  How do I display an image without a link?

Omit the `link` parameter. A link is only added if you specify the `link` parameter.

## 评价

此插件暂无评价。

## 贡献者及开发者

「WP Gallery Image Shortcode」是开源软件。 以下人员对此插件做出了贡献。

贡献者

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

[帮助将「WP Gallery Image Shortcode」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/wpgalleryimage-shortcode)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/wpgalleryimage-shortcode/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/wpgalleryimage-shortcode/)，或通过
[RSS](https://plugins.trac.wordpress.org/log/wpgalleryimage-shortcode/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/wpgalleryimage-shortcode/)。

## 更新日志

#### 1.1

 * Added support for specifying the image by title.
 * Fixed the attachment query to be more reliable.

#### 1.0

 * Initial release.

## 额外信息

 *  版本 **1.1**
 *  最后更新：**16 年前**
 *  活跃安装数量 **10+**
 *  WordPress 版本 ** 2.5 或更高版本 **
 *  已测试的最高版本为 **2.8.5**
 *  语言
 * [English (US)](https://wordpress.org/plugins/wpgalleryimage-shortcode/)
 * 标签
 * [gallery](https://cn.wordpress.org/plugins/tags/gallery/)[images](https://cn.wordpress.org/plugins/tags/images/)
   [shortcode](https://cn.wordpress.org/plugins/tags/shortcode/)
 *  [高级视图](https://cn.wordpress.org/plugins/wpgalleryimage-shortcode/advanced/)

## 评级

尚未提交反馈。

[Your review](https://wordpress.org/support/plugin/wpgalleryimage-shortcode/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/wpgalleryimage-shortcode/reviews/)

## 贡献者

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

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/wpgalleryimage-shortcode/)