The registered names for the coupon post type and its category taxonomy, with query examples.
Names #
| Thing | Name | Notes |
|---|---|---|
| Post type | cctor_coupon |
Public, REST-enabled (rest_base = cctor_coupon), no archive |
| Taxonomy | cctor_coupon_category |
Attached to cctor_coupon |
| Text domain | coupon-creator |
See translate-or-change-text |
The single-coupon permalink is the print view (the plugin swaps in its print template on template_include). The URL bases are options: the coupon slug comes from cctor_coupon_base (defaults to cctor_coupon) and the category slug from cctor_coupon_category_base (defaults to coupon-category). Both are filterable — see actions-filters.
Query examples #
Get published coupons:
$coupons = new WP_Query( array(
'post_type' => 'cctor_coupon',
'post_status' => 'publish',
'posts_per_page' => 10,
) );
Get coupons in a category by slug:
$coupons = new WP_Query( array(
'post_type' => 'cctor_coupon',
'tax_query' => array(
array(
'taxonomy' => 'cctor_coupon_category',
'field' => 'slug',
'terms' => 'summer-sale',
),
),
) );
List the category terms:
$terms = get_terms( array(
'taxonomy' => 'cctor_coupon_category',
'hide_empty' => false,
) );
The [coupon] shortcode runs its own query internally; to alter that query use the cctor_shortcode_query_args filter rather than building your own loop — see filter-shortcode-query.