mycred_my_balance
Description
This shortcode allows you to show the balance of the user viewing the shortcode or a specific user. By default, the balance is displayed formatted with a wrapping element, however these can be disabled and you can show a balance inline without any formatting.
Available since version 1.0.9
Shortcode Attributes
Attribute | Type | Required | Default | Description |
---|---|---|---|---|
user_id |
string | No | current | Option to show the balance of a particular user. Accepts "current" for current user or a user ID. |
title |
string | No | - | Option to show a "title" before the balance element. |
title_el |
string | No | h1 | If a title is set, you can set the HTML element to wrap around the title. |
balance_el |
string | No | div | The balance element wrapping element. Set to empty if you do not want to use this. |
wrapper |
int | No | 1 | Option to wrap the title / balance elements around with a wrapping element (1) or to hide this wrapping element (0). |
formatted |
int | No | 1 | Option to show the balance formatted (1) with a prefix / suffix or show without any formatting (0). Added in 1.7 |
type |
string | No | mycred_default | The point type to show. Should not be used if you only have one point type installed. |
CSS Styling
// outer wrapper (if used) .mycred-my-balance-wrapper { } // balance title element (if used) .mycred-my-balance-wrapper h1 { } // balance wrapper (if used) .mycred-my-balance-wrapper div { }
Examples
Example 1: Default usage:
[mycred_my_balance]
Example 2: Show message for logged out users. (Please note that the old login shortcode attribute was removed!)
[mycred_my_balance]Please login to view your balance[/mycred_my_balance]
Example 3: Remove all wrappers and only show the balance. (required 1.3 or higher)
[mycred_my_balance wrapper=0 title_el="" balance_el=""]
Example 4: Show balance for a custom point type.
[mycred_my_balance type="customtypekey"]