Advertisement
designbymerovingi

myCRED Rank Progress Example

Aug 15th, 2014
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <!-- blog content -->
  2. <div class="blog-content">
  3. <div class="blog-pad blog-content-title">
  4. <h2>Rank: <?php the_title(); ?></h2>
  5. </div>
  6. <div class="blog-pad blog-content-excerpt">
  7. <?php
  8. $post_id = get_the_ID();
  9. $min = get_post_meta( $post_id, 'mycred_rank_min', true );
  10. $max = get_post_meta( $post_id, 'mycred_rank_max', true );
  11. ?>
  12.  
  13. <p>This rank requires a minimum token earnings of <?php echo $mycred->format_creds( $min ); ?>.</p>
  14. <?php if ( is_user_logged_in() ) : ?>
  15.  
  16. <h5>Your rank progress</h5>
  17. <?php
  18. $progress = number_format( ( ( $users_balance / $max ) * 100 ), 1 );
  19. $options = 'options="striped,animated"';
  20.  
  21. if ( $users_balance > $min && $users_balance > $max ) {
  22. $progress = number_format( 100, 1 );
  23. $options = '';
  24. }
  25. elseif ( $users_balance < $min ) {
  26. $progress = number_format( 0, 1 );
  27. $options = '';
  28. }
  29.  
  30. echo do_shortcode( '[vc_row][vc_column width="1/1"][vc_progress_bar values="' . $progress . '|' . get_the_title() . '" bgcolor="custom" ' . $options . ' custombgcolor="#E74C3C" title="" units="%"]<div class="mycred-progress-desc"><div class="rank-minimum">' . $mycred->format_creds( $min ) . '</div><div class="rank-maximum">' . $mycred->format_creds( $max ) . '</div></div>[/vc_column][/vc_row]' );
  31.  
  32. endif;
  33. ?>
  34.  
  35. </div>
  36. <div class="blog-pad blog-content-meta">
  37. <footer class="entry-meta">&nbsp;</footer>
  38. </div>
  39. </div>
  40. <!-- blog content end -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement