Show newest badge of type
-
Good day,
I would like to place a large badge thumbnail in a widget that only shows the newest badge earned from that a given badge type.
How would I go about targeting the newest badge within a specific achievement type?
This is the code I’ve started with, but it is obviously missing the actual targeting of the newest badge.
function fluency_percentage($atts){ $badge_atts = shortcode_atts(array( 'size' => 'auto', 'type' => '', ), $atts ); $size = $badge_atts['size']; $badge_id = ??? $achievement-type = $badge_atts['type'] $image_size = array($size,$size); $earned_achievements = badgeos_get_user_earned_achievement_ids( get_current_user_id() ); $css_class = 'fluency-percentage'; // Set a special css class. if (in_array($badge_id, $earned_achievements)) { $css_class = 'earned-badge'; } $output .= '<span class="badge-icon">'; $output .= badgeos_get_achievement_post_thumbnail( $badge_id, $image_size, $css_class ); $output .= '</span>'; return $output; } add_shortcode('fluency-badge','fluency_percentage');
Any help is greatly appreciated!
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Show newest badge of type’ is closed to new replies.