There are two different types of shortcodes you can use with the WP Coupon’s plugin. Below are examples.
Coupon’s Archive Shortcode
The first shortcode you can use is the one show in the Shortcode 1 Demo. This shortcode allows you to display the archive template for your coupons. Simply use the following on any page or post.
[[wp_coupons]]
You can also add additional information, such as this example.
[[wp_coupons layout="list" limit="9" type="themes" tag="summer 2016" nav="false" sort="title"]]
- layout – The visual layout of the coupon panels displayed. Not Required. Defaults to Archive Layout value set in Display Options.
- Options: (2, 3, 4, 5, list, list-compact, list-minimal)
- limit – The maximum number of posts to display per page. Not Required, Default: 9
- type – The coupon type you wish to display. This will cause the shortcode to only pull in coupons from that type. Will also filter the nav type elements to match the given type. Not Required.
- tag – The coupon tag you wish to display. This will cause the shortcode to only pull in coupons that have the given tag. Not Required.
- nav – If set to ‘false’, this will hide the primary coupon type navigation. Not Required, Default: true
- sort – The sorting order that your coupons will be displayed in.
- Options: (date, modified, title, rand)
Individual Coupon Shortcode
You can also grab the individual shortcode for each coupon itself, as shown in Shortcode 2 Demo.
Step 1
Click into one of your coupons to edit it, and at the bottom you will see that it generates a unique shortcode for it.
Step 2
Simply use that shortcode on any page or post. See example below.
[[coupon id="22"]]
- id – The id of the coupon post that you want to display. If not set, a single coupon will be pulled relative to any other parameters.
And this is what it outputs.
We also have an additional template option to use with the single coupon shortcode if you only want to display the coupon code by itself.
[[coupon id="15" template="codeonly"]]
Additional Parameters
- layout – The visual layout of the coupon panel displayed. Not Required.
- Options: (list, list-compact, list-minimal)
- class – Adds input as CSS class to the coupon panel container div.
- direct_link – Forces the coupon panel to link directly to the Discount URL instead of the Coupon Post.
- Options: true|false
- nofollow – Adds a nofollow tag to the coupon panel hyperlinks.
- Options: true|false
- sort – The sorting order that will be used when pulling a coupon.
- Options: (date, modified, title, rand)
- type – Specify a type to filter the selection pool to coupons with that type.
- tag – Specify a tag to filter the selection pool to coupons with that tag.