mycred_total_balance
Description
This shortcode will show a users total points balance by adding up two or more point types into one.
The result of this shortcode will always be formatted based on the point type with most decimal places (if used). So if you have one point type with no decimals and another with 2 and you add them up in this shortcode, the final result will be rendered with 2 decimal places!
Available since version 1.4.7
Shortcode Attributes
Attribute | Type | Required | Default | Description |
---|---|---|---|---|
user_id |
string or int | No | - | Option show the total balance of a particular user instead of the user viewing the shortcode. |
types |
string | No | mycred_default | Comma separated list of point type keys to add up into one balance. |
raw |
int | No | 0 | Option show the amount formatted (0) or unformatted (1). |
total |
int | No | 0 | Option show the users current balance (0) or their total balance (1). |
CSS Styling
This shortcode does not return any stylable elements.
Examples
Example 1: Add up the default point type and a custom point type that we called “mycustomtype“
[mycred_total_balance types="mycred_default,mycustomtype"]
Example 2: Add up the total balances of the default point type and a custom point type that we called “mycustomtype“
[mycred_total_balance types="mycred_default,mycustomtype" total=1]