mycred_buy_form
Description
This shortcode will generate a html form for purchasing creds. mycred_buy_form offers far more options then the mycred_buy shortcode.
Requires the buyCRED add-on to be enabled.
Available since version 1.1
Shortcode Attributes
Attribute | Type | Required | Default | Description |
---|---|---|---|---|
button |
string | No | "Buy Now" | The form submit button label. |
gateway |
string | No | - | Option to pre-select a particular gateway. Leave empty for users to select the gateway they want to use. |
ctype |
string | No | mycred_default | Option to set the point type the user gets on completed purchases. Leave this empty if you use multiple point types and want your users to select which point type to buy. Should not be used if you only have one point type. |
amount |
int or float | No | - | Option to pre-set the amount of points the users can buy using this shortcode. If not set, the user will need to nominate the amount in the form. The minimum amount you set in your buyCRED settings are applied here. |
gift_to |
int | No | - | Option to gift the purchase to a particular user. If used, you can use either the numeric ID of the user or keywords like "author" for the post author if the shortcode is used inside the loop. |
gift_by |
string | No | - | Used in combination with "gift_to", this is the placeholder text shown in the field where the user nominates who will receive the purchase. This is not used if you set "gift_to" to "author". |
inline |
int | No | 0 | Controlls if the form should be inline (1) or not (0). Requires themes using the Bootstrap framework. |
e_rate |
int or float | No | - | Gateway defined exchange rate can be changed for each shortcode using this attribute e_rate. If admin doesn't provide any exchange rate value utilizing this attribute in a shortcode, gateway defined exchange rate will be applied by default. |
CSS Styling
// The Form form.myCRED-buy-form { }
Examples
Example 1: Default usage:
[mycred_buy_form]
Example 2: Pre-set amount to be 100 points.
[mycred_buy_form amount=100]
Example 3: Pre-select PayPal as the payment gateway used in this form.
[mycred_buy_form gateway="paypal-standard"]