• Resolved Deathsin321

    (@deathsin321)


    Hello,
    I’m using this loop to show all earned Badges.

    $achievements = badgeos_get_user_achievements(‘badges’);

    if ( !empty( $achievements ) ) {
    foreach ( $achievements as $achievement ) {
    echo ‘<div class=”col-md-3 achievement achievement-‘ . $achievement->ID . ‘ achievement-‘ . $achievement->post_type . ‘”>’;
    echo ‘<div>’ . get_the_post_thumbnail( $achievement->ID, ‘thumbnail’ ) . ‘</div>’;
    echo ‘<div class=”badge-title”>’ . get_the_title( $achievement->ID ) . ‘</div>’;
    echo ‘<div class=”badge-pts”>+’ . get_post_meta( $achievement->ID , ‘_badgeos_points’, true ) . ‘ pkt</div>’;
    echo ‘</div>’;
    }
    } else {
    _e( ‘No Badges’, ‘text-domain’ );
    }

    Now I need to display in section below loop with Badges which are still to get.

    Please help

    https://wordpress.org/plugins/badgeos/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    You could use badgeos_get_achievements() and loop through them, and you could reuse your $achievements variable above to check if the user already has the currently iterated achievement, and skip if they do.

    Did you end up getting it to work? I would love to see your code. I’m trying to do the same thing, but I have 0 php skill.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Display "unearned" Badges’ is closed to new replies.