Title: CartTrigger – BAG
Author: Poletto 1976
Published: <strong>2026 年 3 月 19 日</strong>
Last modified: 2026 年 5 月 23 日

---

搜索插件

![](https://ps.w.org/carttrigger-bag/assets/banner-772x250.png?rev=3486351)

![](https://ps.w.org/carttrigger-bag/assets/icon-256x256.png?rev=3486344)

# CartTrigger – BAG

 作者：[Poletto 1976](https://profiles.wordpress.org/polettoespana/)

[下载](https://downloads.wordpress.org/plugin/carttrigger-bag.2.0.10.zip)

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

 [支持](https://wordpress.org/support/plugin/carttrigger-bag/)

## 描述

**CartTrigger – BAG** (Brand · Awards · Gallery) extends the WooCommerce native 
brand taxonomy with three powerful modules:

#### Custom Fields

Attach unlimited key–value pairs to any brand. Output them anywhere via shortcode
or PHP helper function. CSS classes are fully customisable, including Tailwind arbitrary-
value classes (e.g. `text-[11px]`).

#### Awards

Manage a list of awards and recognitions for each brand — with optional logo, award
name, event name, and year. Display them as a styled list using the `[ctbag_awards]`
shortcode.

#### Gallery

Upload a curated image gallery per brand. Display it as a responsive grid with the`[
ctbag_gallery]` shortcode. Optional native WooCommerce lightbox (PhotoSwipe) via`
lightbox="1"`.

#### Shortcodes

**`[ctbag_custom_fields]`**
 Outputs brand custom fields as a `<dl>` list.

    ```
    [ctbag_custom_fields brand="slug" wrapper_class="..." dt_class="..." dd_class="..."]
    ```

**`[ctbag_awards]`**
 Outputs brand awards as a styled card list.

    ```
    [ctbag_awards brand="slug" title="Awards" wrapper_class="..." card_class="..."]
    ```

**`[ctbag_gallery]`**
 Outputs brand gallery as a responsive image grid.

    ```
    [ctbag_gallery brand="slug" title="Gallery" wrapper_class="..." lightbox="1"]
    ```

#### PHP Helper Functions

All shortcodes are also available as direct PHP functions that bypass WordPress’
shortcode parser — useful when Tailwind arbitrary-value classes (e.g. `text-[11px]`)
would otherwise be mangled:

    ```
    echo ctbag_custom_fields(['wrapper_class' => 'grid grid-cols-2 gap-4']);
    echo ctbag_awards(['title' => __('Awards', 'your-textdomain')]);
    echo ctbag_gallery(['title' => __('Gallery', 'your-textdomain'), 'lightbox' => '1']);
    ```

#### Professional Admin UI

All brand meta fields are presented in a clean, card-based admin interface grouped
by module (HTML Description, Custom Fields, Awards, Gallery), with collapsible shortcode
reference built in. Custom fields and awards support drag & drop reordering. Gallery
images can be removed individually (× button on hover) and reordered by dragging.

## 屏幕截图

 * [[
 * Brand edit screen — plugin banner with HTML Description module (TinyMCE editor).
 * [[
 * Custom Fields, Awards, and Gallery modules with drag & drop support.

## 安装

 1. Upload the `carttrigger-bag` folder to the `/wp-content/plugins/` directory.
 2. Activate the plugin through the **Plugins** menu in WordPress.
 3. Go to **Products  Brands** and edit any brand to start adding content.

## 常见问题

### Does this plugin require WooCommerce?

Yes. WooCommerce must be active before activating CartTrigger – BAG. The plugin 
declares a `Requires Plugins: woocommerce` dependency.

### Does it require a specific WooCommerce version?

WooCommerce 8.0 or higher is recommended. The plugin has been tested up to WooCommerce
10.7.0.

### Can I use Tailwind CSS classes in the shortcode attributes?

Yes, but classes containing square brackets (e.g. `text-[11px]`) will be interpreted
as shortcode closing tags by WordPress. Use the PHP helper functions instead — they
bypass the shortcode parser entirely.

### Where is the gallery lightbox loaded?

The lightbox uses WooCommerce’s bundled PhotoSwipe library. It is only active when`
lightbox="1"` is set. On pages where WooCommerce scripts are disabled, a graceful
fallback (open image in new tab) is used automatically.

### Gallery images look blurry or load slowly — what image size should I use?

The `size_thumb` parameter controls which registered WordPress image size is used
for gallery thumbnails. The default is `medium_large` (typically 768 px wide), which
is appropriate for large single-column layouts. If your gallery is displayed in 
a multi-column grid (3–4 columns), use `size_thumb="medium"` (300 px) to reduce 
file weight by 4–6× with no visible quality loss:

    ```
    [ctbag_gallery size_thumb="medium" lightbox="1"]
    ```

Or via PHP helper:

    ```
    echo ctbag_gallery(['size_thumb' => 'medium', 'lightbox' => '1']);
    ```

### Brand pages load slowly — any caching recommendations?

Brand taxonomy pages contain no user-specific content (no cart, no session), so 
they are ideal candidates for full-page caching. Make sure your caching plugin (
LiteSpeed Cache, WP Rocket, W3 Total Cache…) does **not** exclude brand taxonomy
pages from its cache.

Since version 2.0.8, PhotoSwipe (4 CSS/JS files) is only enqueued on brand pages
that actually have a gallery, so brands without a gallery already load significantly
fewer assets.

If you use LiteSpeed Cache and notice that brand pages are slow after a product 
update, check whether “Smart Purge on Product Update” is purging brand taxonomy 
pages. Enabling the LiteSpeed Crawler ensures the cache is regenerated automatically
in the background so visitors never hit an uncached page.

## 评价

此插件暂无评价。

## 贡献者及开发者

「CartTrigger – BAG」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Poletto 1976 ](https://profiles.wordpress.org/polettoespana/)

「CartTrigger – BAG」插件已被翻译至 1 种本地化语言。 感谢[所有译者](https://translate.wordpress.org/projects/wp-plugins/carttrigger-bag/contributors)
为本插件所做的贡献。

[帮助将「CartTrigger – BAG」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/carttrigger-bag)

### 对开发感兴趣吗?

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

## 更新日志

#### 2.0.10

 * Compatibility: WordPress 7.0.
 * Fix: replaced str_ends_with() with PHP 7.4 compatible equivalent.

#### 2.0.9

 * Fix: corrected Contributors username in readme.txt to match the WordPress.org
   plugin owner account.

#### 2.0.8

 * Perf: PhotoSwipe CSS and JS are now enqueued only on brand pages that have a 
   gallery, instead of on every brand page. Brands without a gallery no longer load
   4 unnecessary assets (2 CSS + 2 JS).

#### 2.0.7

 * Fix: gallery images not saved after selection in the media uploader. Root cause:
   HTML input had `id="ctb_gallery"` while the admin JS targeted `#ctbag_gallery`,
   so the hidden field was never updated before form submission.

#### 2.0.6

 * Fix: fatal error on brand save due to mismatched method name after 2.0.5 prefix
   rename (`ctbag_save_term_meta`).
 * Fix: added one-time migration to move existing term meta from legacy `ctb_*` 
   keys to `ctbag_*` keys.

#### 2.0.5

 * Compliance: renamed all shortcodes and PHP helper functions from `ctb_*` to `
   ctbag_*` to meet the WordPress.org 5-character prefix requirement (`ctbag` = 
   CartTrigger BAG).
 * Compliance: extracted inline gallery lightbox JavaScript to an external file (`
   assets/js/ctbag-gallery-lightbox.js`) loaded via `wp_enqueue_script()`.
 * Compatibility: WC tested up to 10.7.0.

#### 2.0.4

 * New: Gallery — individual image removal with an × button that appears on hover,
   without reopening the media uploader.
 * New: Gallery — drag & drop reordering of thumbnails (jQuery UI Sortable).
 * New: Custom Fields — drag & drop reordering of field rows via a handle icon.
 * New: Awards — drag & drop reordering of award rows via a handle icon.

#### 2.0.3

 * Fix: double-quote characters (`"`) in award names, event names, and custom field
   values were corrupted on save. Root cause: WordPress calls `wp_unslash()` (stripslashes)
   on meta values inside `add_metadata()`, which stripped the backslash from `\"`
   in the JSON string, producing invalid JSON. Fix: awards and custom fields are
   now stored as native PHP arrays via `maybe_serialize()` — no backslash escaping
   involved, immune to the slashing issue. Backward-compatible: existing JSON-format
   data is still read correctly.
 * Fix: accented characters (é, à, ó…) in award/field text were silently dropped
   on some server configurations. Replaced `sanitize_text_field()` with `wp_strip_all_tags()`
   to avoid the internal `wp_check_invalid_utf8()` call that incorrectly rejected
   valid multi-byte characters.

#### 2.0.0

 * Complete rewrite with professional admin UI (module cards).
 * Added HTML Description module with TinyMCE editor on both Add and Edit brand 
   screens.
 * Added native WooCommerce lightbox (PhotoSwipe) support for gallery shortcode.
 * Added activation notice with link to brand management screen.
 * Plugin fully internationalised — translations available for Italian (it_IT) and
   Spanish (es_ES).

## 额外信息

 *  版本 **2.0.10**
 *  最后更新：**5 天前**
 *  活跃安装数量 **不到10**
 *  WordPress 版本 ** 6.3 或更高版本 **
 *  已测试的最高版本为 **7.0**
 *  PHP 版本 ** 7.4 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/carttrigger-bag/) 和 [Italian](https://it.wordpress.org/plugins/carttrigger-bag/).
 *  [翻译成简体中文](https://translate.wordpress.org/projects/wp-plugins/carttrigger-bag)
 * 标签
 * [Awards](https://cn.wordpress.org/plugins/tags/awards/)[brand management](https://cn.wordpress.org/plugins/tags/brand-management/)
   [brands](https://cn.wordpress.org/plugins/tags/brands/)[gallery](https://cn.wordpress.org/plugins/tags/gallery/)
   [woocommerce](https://cn.wordpress.org/plugins/tags/woocommerce/)
 *  [高级视图](https://cn.wordpress.org/plugins/carttrigger-bag/advanced/)

## 评级

尚未提交反馈。

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

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

## 贡献者

 *   [ Poletto 1976 ](https://profiles.wordpress.org/polettoespana/)

## 支持

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

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