The hooks Coupon Creator fires while rendering the shortcode view, the print view, and the admin screens, so you can add, remove, or alter output.
Coupon output is assembled entirely from hooks: a builder function (cctor_shortcode_functions for the shortcode, cctor_print_template for print) attaches the default callbacks, then the template fires the actions below. To customize, unhook a default callback and add your own on the same action, or hook the empty extension points. See themers-guide for the pattern.
Shortcode template — actions #
| Action | Params | Fires |
|---|---|---|
cctor_shortcode_start |
— | Before the shortcode output buffer |
cctor_before_coupon_wrap |
— | Before the coupon loop |
cctor_before_coupon |
$coupon_id |
Per coupon, before its wrapper (also runs the builder) |
cctor_before_coupon_inner_wrap |
$coupon_id |
Inside the outer wrap |
cctor_img_coupon |
$coupon_id, $couponimage, $bordertheme |
Renders an image coupon |
cctor_coupon_deal |
$coupon_id |
Renders the deal heading |
cctor_coupon_terms |
$coupon_id |
Renders the terms |
cctor_coupon_expiration |
$coupon_id, $coupon_expiration |
Renders the expiration line |
cctor_coupon_link |
$coupon_id |
Renders the "Click to Open in Print View" link |
cctor_no_show_coupon |
$coupon_id, $coupon_expiration, $coupon_align |
When a coupon is hidden/expired |
cctor_after_coupon |
$coupon_id |
Per coupon, after its wrapper |
cctor_shortcode_end |
— | After the output buffer |
cctor_shortcode_template_functions |
— | Builder hook — add your shortcode callbacks here |
Shortcode template — filters #
| Filter | Params | Returns |
|---|---|---|
cctor_default_totalcoupons |
$default (50) |
Cap for a bare [coupon] with no totalcoupons |
cctor_shortcode_query_args |
$args |
The WP_Query args (see filter-shortcode-query) |
cctor_shortcode_query_args_{filterid} |
$args |
Same, scoped to a shortcode's filterid |
cctor_outer_content_wrap |
$coupon_id, $coupon_align, $bordertheme |
start_wrap/end_wrap markup array |
cctor_inner_content_wrap |
$coupon_id, $bordertheme |
Inner wrap markup array |
cctor_image_url |
$coupon_id, 'single_coupon' |
Image-coupon URL |
cctor_deal_inline_style |
$style, $coupon_id |
The deal element's inline style value. Return '' to drop it — token-driven templates do this so the stylesheet wins |
cctor_coupon_tokens |
$tokens, $coupon_id |
Map of CSS custom property to value set on the coupon container (see css-reference) |
cctor_contrast_ink |
$ink, $background, $luminance |
The automatically chosen black/white text color for a given background |
cctor_coupon_template_paths |
$paths |
Base paths searched for src/views/type/{type}.php templates |
Print template — actions #
| Action | Params | Fires |
|---|---|---|
cctor_action_print_template |
$coupon_id |
Top of the print page (runs the print builder) |
coupon_print_meta |
— | Inside <head> — meta, base CSS, stylesheets |
coupon_print_head |
— | Inside <head>, after meta (used for inline CSS) |
cctor_print_before_coupon |
$coupon_id |
Before the coupon |
cctor_print_image_coupon |
$coupon_id, $couponimage |
Renders an image coupon |
cctor_print_coupon_deal |
$coupon_id |
Renders the deal |
cctor_print_coupon_terms |
$coupon_id |
Renders the terms |
cctor_print_coupon_expiration |
$coupon_id, $coupon_expiration |
Renders the expiration |
cctor_click_to_print_coupon |
$coupon_id |
Renders the "Click to Print" button |
cctor_print_no_show_coupon |
$coupon_id, $coupon_expiration |
When a coupon is hidden/expired (see expired-message-print-view) |
cctor_print_after_coupon |
$coupon_id |
After the coupon |
coupon_footer |
— | Before </body> |
cctor_print_template_functions |
— | Builder hook — add your print callbacks here |
Print template — filters #
| Filter | Params | Returns |
|---|---|---|
cctor_print_outer_content_wrap |
$coupon_id |
Outer wrap markup array |
cctor_print_inner_content_wrap |
$coupon_id |
Inner wrap markup array |
cctor_print_image_url |
$coupon_id, 'print_coupon' |
Image URL |
cctor_filter_inline_css |
$css |
Extra CSS injected into both front-end and print views |
Admin — actions #
| Action | Params | Fires |
|---|---|---|
cctor_add_meta_box |
$post |
When the coupon meta box is registered |
pngx_meta_message |
$post |
Above the meta box |
cctor_admin_assets |
— | After admin scripts/styles enqueue |
cctor_activate |
— | On plugin activation |
cctor_deactivate |
— | On plugin deactivation |
Admin — filters #
| Filter | Params | Alters |
|---|---|---|
cctor_filter_meta_tabs |
$tabs |
Meta box tabs |
cctor_filter_meta_fields |
$fields |
All meta fields |
cctor_filter_meta_template_fields |
$fields |
Template (content) meta fields |
cctor_filter_coupon_list_columns |
$columns, $wp_columns |
Coupon list columns |
cctor_filter_column_cases |
$column, $post_id, $coupon_expiration |
Column cell content |
cctor_option_sections |
$sections |
Options-page sections |
cctor_option_filter |
$fields |
Options-page fields |
cctor_inserter_total_coupons |
$total (50) |
How many coupons the classic-editor Add Coupon inserter lists |
Query & general #
| Hook | Type | Params |
|---|---|---|
cctor_coupon_parse_query |
action | $query |
cctor_filter_ignore_expiration |
filter | $show, $coupon_id |
cctor_filter_meta_show_coupon_check |
filter | $hidden, $coupon_id |
cctor_filter_searchable_post_types |
filter | $post_types |
cctor_img_size |
filter | $sizes (single 300 / print 390) |
cctor_is_coupon |
filter | $bool, $post_id |
cctor_coupon_slug / cctor_category_slug |
filter | URL bases |
cctor_coupon_label_singular (+ _plural, _lowercase, category variants) |
filter | Post-type labels — see translate-or-change-text |
coupon_creator_plugin_loaded |
action | Fired once the plugin is ready |