Gatemi Trust Badges Developer Reference

Classic WordPress code: four GMTB_* classes in includes/ (GMTB_Icons, GMTB_Settings, GMTB_Render, GMTB_Admin), no JavaScript, no HTTP. Constants GMTB_VERSION, GMTB_PLUGIN_FILE, GMTB_PLUGIN_DIR, GMTB_PLUGIN_URL. Text domain gatemi-trust-badges. Boots on plugins_loaded at priority 20.

Filters

gmtb_settings

The merged settings array, after defaults. Only the plugin's own keys are taken from the result, and every consumer re-validates what it reads (the colour as a colour, seals against those the site may show).

Argument Type
$settings array — placements, payments, heading, seals, labels, accent
// Add the cart placement without touching the saved option.
add_filter( 'gmtb_settings', function ( $s ) {
	$s['placements'][] = 'cart';
	return $s;
} );

gmtb_gateways

The payment methods the row names.

Argument Type
$methods array<int, array{id:string, title:string, glyph:string}>

glyph is one of card, bank, wallet, cash, lock, shield, returns, delivery, support. Applied even when the payment row is switched off (with an empty list).

// Leave internal "staff only" gateways off the row.
add_filter( 'gmtb_gateways', function ( $methods ) {
	return array_values( array_filter( $methods, function ( $m ) {
		return 'staff_account' !== $m['id'];
	} ) );
} );

gmtb_seals

The seals a page shows, after the HTTPS check.

Argument Type
$seals array<int, array{key:string, label:string, glyph:string}>
// Add a "Made in Wales" line with the shield glyph.
add_filter( 'gmtb_seals', function ( $seals ) {
	$seals[] = array( 'key' => 'local', 'label' => 'Made in Wales', 'glyph' => 'shield' );
	return $seals;
} );

A glyph key the plugin does not ship draws no icon.

gmtb_badges

The finished row's HTML, immediately before it is returned.

Argument Type
$html string
$where string — product, cart, checkout or shortcode

Whatever you return is passed through wp_kses() over the row's own allowlist (div, p, ul, li, span, svg, path, rect, circle with their shape attributes), so markup outside that list is removed.

The plugin fires no actions of its own.

Option

Option Default
gmtb_settings placements ['product','checkout'], payments 'yes', heading '', seals ['secure','returns'], labels [], accent ''

Placements are limited to product, cart, checkout; seals to secure, guarantee, returns, delivery, support; accent must match #rgb or #rrggbb.

Shortcode

[gatemi_trust_badges] — no attributes; returns the row with the class gmtb--shortcode and ignores the placement settings.

WooCommerce and WordPress hooks used

Hook Use
woocommerce_after_add_to_cart_button Product placement
woocommerce_after_cart_totals Cart placement, classic cart
woocommerce_review_order_after_submit Checkout placement, classic checkout
render_block_woocommerce/cart Cart placement, appended after the Cart block
render_block_woocommerce/checkout Checkout placement, appended after the Checkout block
wp_enqueue_scripts Registers the gmtb-badges stylesheet; enqueued only once a row is drawn
before_woocommerce_init Declares HPOS and Cart & Checkout Blocks compatibility

Gateways are read with WC()->payment_gateways()->get_available_payment_gateways().

Admin

  • Screen: WooCommerce → Trust badges, slug gmtb-trust-badges, capability manage_woocommerce.
  • Posts to itself with gmtb_form and nonce action gmtb_save; redirects back with gmtb-saved=1.
  • Stylesheets gmtb-admin and gmtb-badges are loaded on that screen only.

CSS classes

Class Element
.gmtb The row; plus .gmtb--product, .gmtb--cart, .gmtb--checkout, .gmtb--shortcode
.gmtb-heading The optional line above
.gmtb-seals, .gmtb-seal, .gmtb-seal--{key} The seals list and items
.gmtb-payments, .gmtb-payment The payment row and items
.gmtb-glyph Each SVG
.gmtb-label Each piece of text

Custom property --gmtb-accent colours the glyphs (defaults to currentColor).

/* Centre the row under the add-to-cart button. */
.gmtb--product .gmtb-seals,
.gmtb--product .gmtb-payments { justify-content: center; }

Uninstall

uninstall.php deletes gmtb_settings. Nothing else is stored.

Shopping Cart
Scroll to Top