定制 ralfhortt/term-thumbnails 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ralfhortt/term-thumbnails

Composer 安装命令:

composer require ralfhortt/term-thumbnails

包简介

Post Thumbnails for WordPress Terms

README 文档

README

CI

Post Thumbnails for WordPress Terms. The selected attachment is exposed as the term_thumbnail_id REST term meta field.

Requirements

  • PHP 8.4+
  • WordPress 6.0+

Installation

  • Drop the plugin into your plugin directory and activate it in the WordPress backend.
  • Go to any term page and add an image.

Gutenberg Block

The plugin registers a term-thumbnails/term-thumbnail block for use in block-theme templates and the Query Loop block. It supports:

  • Image size — choose any registered image size
  • Aspect ratio — Original, 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16
  • Scale — Cover, Contain, Fill (shown when an aspect ratio is set)
  • Link to term — optionally link the image to the current term archive
  • Dimensions, border, spacing, shadow, and duotone — provided by block supports

Template Tags

get_term_thumbnail_id( int $term_id ): int|false
has_term_thumbnail( int $term_id ): bool
the_term_thumbnail( string|array $size = 'post-thumbnail', string|array $attr = '' ): void
get_term_thumbnail( int $term_id, string|array $size = 'post-thumbnail', string|array $attr = '' ): string

Existing _thumbnail_id values are migrated once to term_thumbnail_id. New reads and writes use only term_thumbnail_id.

Hooks

Filters

Filter Description
term-thumbnail-taxonomies Array of taxonomy slugs that support thumbnails. Defaults to all registered taxonomies.
{$taxonomy}-has-thumbnails Return false to disable thumbnail support for a specific taxonomy.
term_thumbnail_size Override the image size used by get_term_thumbnail().
term_thumbnail_html Filter the final <img> HTML returned by get_term_thumbnail().

Examples

// Disable thumbnails for categories.
add_filter( 'category-has-thumbnails', '__return_false' );

// Limit thumbnails to a custom taxonomy only.
add_filter( 'term-thumbnail-taxonomies', fn() => [ 'genre' ] );

Screenshots

Term listing

Term listing

Term listing with image

Term listing with image

Term edit page

Term edit page

Term edit page with image

Term edit page with image

Changelog

v3.0.0

  • Complete rewrite: PSR-4 namespaced PHP 8.4 architecture
  • Replaced jQuery admin JS with vanilla JS + @wordpress/api-fetch
  • Replaced wp_ajax_* handlers with the WordPress REST API (register_term_meta with show_in_rest: true)
  • Added Gutenberg block (term-thumbnails/term-thumbnail) with aspect ratio, scale, image size, and focal point controls
  • Build tooling migrated to @wordpress/scripts
  • Added Pest test suite

v2.1.0

  • Added: Composer support

v2.0.1

  • Fix: Remove warning

v2.0.0

  • Switch from options to term meta structure

v1.0.2

  • Fix: Missing term images for custom taxonomies

v1.0.1

  • Added: Screenshots
  • Added: readme.txt
  • Enhancement: Security improvements
  • Fix: Typo on term edit page

v1.0

  • Initial release

ralfhortt/term-thumbnails 适用场景与选型建议

ralfhortt/term-thumbnails 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 144 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 09 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ralfhortt/term-thumbnails 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ralfhortt/term-thumbnails 我们能提供哪些服务?
定制开发 / 二次开发

基于 ralfhortt/term-thumbnails 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 144
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2019-09-08