Codex / mycred/balance / Shortcodes / mycred_total_balance


This shortcode will show a users total points balance by adding up two or more point types into one.

Available since version 1.4.7

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!

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_TYPE_KEY 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.


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]

Last edited August 25, 2016