mycred_my_badges

Codex / mycred/badge / Shortcodes / mycred_my_badges

Description

This shortcode will show the user who is viewing it their earned badges. This shortcode will not show all badges no matter if a user has earned them or not. To show all badges, please use the mycred_badges shortcode instead.

Requires the Badges add-on to be enabled.

Available since version 1.5

Shortcode Attributes

Attribute Type Required Default Description
show string No earned Option to set if you want to show the badges a user has earned (earned) or if you want to show all badges (all).
width int No MYCRED_BADGE_WIDTH The width of each badge image in pixels without the px. Do not use if you want to use the width set by the MYCRED_BADGE_WIDTH constant.
height int No MYCRED_BADGE_HEIGHT The height of each badge image in pixels without the px. Do not use if you want to use the height set by the MYCRED_BADGE_HEIGHT constant.
user_id string No current Option to show badges of a particular user. Accepts "current" for current user or a user ID.

CSS Styling

ul.mycred-users-badges { }

// Earned badges
ul.mycred-users-badges img { }

// All badges
ul.mycred-users-badges div.the-badge { }

Examples

Example 1: Default usage (show earned badges).

[mycred_my_badges]

Example 2: Show all badges, even those the user has not yet earned.

[mycred_my_badges show="all"]

Last edited June 23, 2016