Theme Hooks Reference (flavor_*)
All hooks use the flavor_ prefix. Parameters shown with types.
Layout Hooks
Header
These hooks fire in order during header rendering:
flavor_header_before
<header>
flavor_header_start
[...header content...]
flavor_header_end
</header>
flavor_header_after
<main>
flavor_content_before
| Hook | Parameters | Description |
|---|---|---|
flavor_header_before | — | Before the <header> element |
flavor_header_start | — | Start of <header>, before header content |
flavor_header_end | — | End of <header>, after header content |
flavor_header_after | — | After <header> closes |
add_action('flavor_header_before', function() {
echo '<div class="announcement-bar">Free shipping over 50EUR!</div>';
});
Footer
These hooks fire in order during footer rendering:
flavor_content_after
</main>
flavor_footer_before
<footer>
flavor_footer_start
[...footer content...]
flavor_footer_widgets
flavor_footer_social
flavor_footer_end
</footer>
flavor_footer_after
| Hook | Parameters | Description |
|---|---|---|
flavor_content_before | — | After header, before main content area |
flavor_content_after | — | After main content, before footer |
flavor_footer_before | — | Before the <footer> element |
flavor_footer_start | — | Start of <footer> |
flavor_footer_widgets | — | Inside footer widget area |
flavor_footer_social | — | In footer social links area |
flavor_footer_end | — | End of <footer> |
flavor_footer_after | — | After <footer> closes |
flavor_render_footer | — | Triggers footer template rendering (internal) |
add_action('flavor_footer_before', function() {
echo '<div class="pre-footer-cta">Subscribe to our newsletter!</div>';
});
add_action('flavor_footer_widgets', function() {
echo '<div class="footer-trust-badges">...</div>';
});
eCommerce Page Hooks
Shop / Product Listing
| Hook | Parameters | Description |
|---|---|---|
flavor_shop_before | — | Before shop/product listing content |
flavor_shop_after | — | After shop/product listing content |
add_action('flavor_shop_before', function() {
echo '<div class="shop-promotion-banner">Summer Sale — 20% off!</div>';
});
Single Product
| Hook | Parameters | Description |
|---|---|---|
flavor_single_product_before | — | Before single product content |
flavor_single_product_summary | — | Inside product summary (after title/price, before tabs) |
flavor_single_product_tabs | — | In product tabs area |
flavor_product_actions | $product | In product actions area (add to cart, wishlist, etc.) |
flavor_single_product_related | — | In related products area |
flavor_single_product_after | — | After all single product content |
add_action('flavor_single_product_summary', function() {
echo '<div class="trust-badges"><img src="..." alt="Secure checkout" /></div>';
});
add_action('flavor_product_actions', function($product) {
echo '<button class="size-guide-btn" data-product="' . esc_attr($product->id) . '">Size Guide</button>';
});
Categories
| Hook | Parameters | Description |
|---|---|---|
flavor_categories_before | — | Before categories listing |
flavor_categories_after | — | After categories listing |
Cart
| Hook | Parameters | Description |
|---|---|---|
flavor_cart_before | — | Before cart content |
flavor_cart_after | — | After cart content |
add_action('flavor_cart_before', function() {
echo '<div class="free-shipping-progress">Add 15EUR more for free shipping!</div>';
});
Checkout
| Hook | Parameters | Description |
|---|---|---|
flavor_checkout_before | — | Before checkout form |
flavor_checkout_after | — | After checkout form |
add_action('flavor_checkout_before', function() {
echo '<div class="checkout-trust"><span>Secure 256-bit SSL Checkout</span></div>';
});
Order Received
| Hook | Parameters | Description |
|---|---|---|
flavor_order_received_before | — | Before order received / thank you page |
flavor_order_received_after | — | After order received / thank you page |
My Account
| Hook | Parameters | Description |
|---|---|---|
flavor_account_before | — | Before my-account page content |
flavor_account_after | — | After my-account page content |
Theme Lifecycle Hooks
Actions
| Hook | Parameters | Description |
|---|---|---|
flavor_initialized | $bootstrap | After theme DDD bootstrap completes |
flavor_register_services | $container | During theme service registration |
flavor_components_loaded | $bootstrap | After all theme components are loaded |
flavor_register_translations | — | When the translation system initializes — register custom strings here |
flavor_register_modules | $manager | When the module manager collects modules (Module System 2.0) — register custom modules here |
add_action('flavor_initialized', function($bootstrap) {
// Theme is ready — safe to interact with theme services
});
Registering a custom module (Module System 2.0)
Modules are classes extending Flavor\Modules\AbstractModule. Register them by class name on flavor_register_modules; the manager reads all metadata from the class itself:
add_action('flavor_register_modules', function($manager) {
$manager->register(\MyVendor\Modules\MyCustomModule::class);
});
Translatable Strings
The theme has its own translation registry (independent of WordPress i18n, backed by the theme's own DB table). Register strings on flavor_register_translations, then read them with flavor_t() / flavor_te().
add_action('flavor_register_translations', function() {
// Batch register (recommended)
Flavor_Translation_Registry::registerMany([
'my_plugin.welcome' => 'Welcome to our store',
'my_plugin.cta' => 'Shop now',
]);
// …or a single string with optional translator context
Flavor_Translation_Registry::register('my_plugin.badge', 'New', 'Product badge label');
});
// Read the (possibly translated) value:
echo flavor_t('my_plugin.welcome'); // returns the string
flavor_te('my_plugin.cta'); // echoes it, HTML-escaped
Keys are dot-namespaced (vendor.area.item); the first segment groups strings in the Translations admin screen. flavor_t($key, $default) falls back to $default (or the key itself) when a key is unregistered.
flavor_register_string() does not existEarlier drafts referenced a flavor_register_string() helper — there is no such function. Always register through Flavor_Translation_Registry::register() / ::registerMany() inside a flavor_register_translations callback, and read with flavor_t() / flavor_te().
Page Builder Hooks
| Hook | Type | Parameters | Description |
|---|---|---|---|
flavor_builder_register_dynamic_tags | action | $registry | Register custom dynamic tags for the Visual Page Builder. $registry is the DynamicTags instance. |
flavor_builder_post_types | filter | $postTypes | Which post types support the Visual Page Builder (see Filters) |
add_action('flavor_builder_register_dynamic_tags', function($registry) {
// $registry->addTag(...) — expose a custom dynamic value to builder blocks
});
Module Hooks
Stock Alerts
| Hook | Parameters | Description |
|---|---|---|
flavor_stock_alert_subscribed | $productId, $email, $variantId | Customer subscribes to stock alert |
flavor_stock_alert_sent | $alertId, $alert | Stock alert email sent |