Title: Theme Image Block
Author: Happy Prime
Published: <strong>2025 年 12 月 16 日</strong>
Last modified: 2026 年 2 月 20 日

---

搜索插件

![](https://s.w.org/plugins/geopattern-icon/theme-image-block.svg)

# Theme Image Block

 作者：[Happy Prime](https://profiles.wordpress.org/happyprime/)

[下载](https://downloads.wordpress.org/plugin/theme-image-block.1.1.1.zip)

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

 [支持](https://wordpress.org/support/plugin/theme-image-block/)

## 描述

The Theme Image Block plugin allows you to register images from your theme and make
them available as blocks in the WordPress editor. This is useful for logos, icons,
and other images that are part of your theme’s design system.

### Usage

### Registering Theme Images

Theme images should be registered using `HappyPrime\ThemeImageBlock\register_theme_image()`.
This is likely best done on the `init` or `after_setup_theme` action.

    ```
    HappyPrime\ThemeImageBlock\register_theme_image(
        'happy-prime-logo',
        [
            'title' => 'Happy Prime Logo',
            'description' => 'The Happy Prime logo.',
            'alt' => 'Happy Prime',
            'path' => 'images/happy-prime-logo.svg',
            'width' => '300',
            'height' => '',
            'variations' => [
                'small' => [
                    'path'   => 'images/happy-prime-logo-small.svg',
                    'width'  => '100',
                    'height' => '100',
                ],
                'medium' => [
                    'path'   => 'images/happy-prime-logo-medium.svg',
                    'width'  => '200',
                    'height' => '200',
                ],
                'large' => [
                    'path'   => 'images/happy-prime-logo-large.svg',
                    'width'  => '300',
                    'height' => '300',
                ],
            ],
            'sizes' => '(max-width: 600px) 100vw, 300px',
        ]
    );
    ```

### Registering Theme Image Styles

Theme image styles should be registered using `HappyPrime\ThemeImageBlock\register_theme_image_style()`.
This is likely best done on the `init` or `after_setup_theme` action.

    ```
    HappyPrime\ThemeImageBlock\register_theme_image_style(
        'hero',
        [
            'name'   => 'Hero',
            'width'  => 'clamp(10rem, 100vw, 60rem)',
            'height' => 'auto',
        ]
    );
    ```

## 区块

该插件提供了 1 个区块.

 *   Theme Image Display an image from the theme's images directory.

## 安装

 1. Install and activate the plugin.
 2. Register theme images using the `register_theme_image()` function.
 3. Register theme image styles using the `register_theme_image_style()` function.
 4. Use the Theme Image block in the editor to insert registered images.

## 评价

此插件暂无评价。

## 贡献者及开发者

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

贡献者

 *   [ Happy Prime ](https://profiles.wordpress.org/happyprime/)
 *   [ Jeremy Felt ](https://profiles.wordpress.org/jeremyfelt/)
 *   [ slocker ](https://profiles.wordpress.org/slocker/)
 *   [ philcable ](https://profiles.wordpress.org/philcable/)

[帮助将「Theme Image Block」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/theme-image-block)

### 对开发感兴趣吗?

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

## 更新日志

### 1.1.1

 * Prevent fatal error on activation.
 * Improve HTML processing when rendering output.
 * Fix reference to renamed global JavaScript variable.
 * Fix textdomain mismatch.
 * Improve support for multiple theme image blocks in one editor view.

### 1.1.0

 * Initial release on wp.org.

### 1.0.0

 * Initial release.

## 额外信息

 *  版本 **1.1.1**
 *  最后更新：**4 月前**
 *  活跃安装数量 **不到10**
 *  WordPress 版本 ** 6.8 或更高版本 **
 *  已测试的最高版本为 **6.9.4**
 *  PHP 版本 ** 7.4 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/theme-image-block/)
 * 标签
 * [images](https://cn.wordpress.org/plugins/tags/images/)[media](https://cn.wordpress.org/plugins/tags/media/)
 *  [高级视图](https://cn.wordpress.org/plugins/theme-image-block/advanced/)

## 评级

尚未提交反馈。

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

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

## 贡献者

 *   [ Happy Prime ](https://profiles.wordpress.org/happyprime/)
 *   [ Jeremy Felt ](https://profiles.wordpress.org/jeremyfelt/)
 *   [ slocker ](https://profiles.wordpress.org/slocker/)
 *   [ philcable ](https://profiles.wordpress.org/philcable/)

## 支持

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

 [查看支持论坛](https://wordpress.org/support/plugin/theme-image-block/)