| @@ -1,0 +1,57 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Inline Points template | |
| 4 | + * | |
| 5 | + * This template can be overridden by copying it to yourtheme/gamipress/inline-points.php | |
| 6 | + * To override a specific points type just copy it as yourtheme/gamipress/inline-points-{points-type}.php | |
| 7 | + */ | |
| 8 | +global $gamipress_template_args; | |
| 9 | + | |
| 10 | +// Shorthand | |
| 11 | +$a = $gamipress_template_args; | |
| 12 | + | |
| 13 | +// Setup thumbnail size | |
| 14 | +$thumbnail_size = absint( $a['thumbnail_size'] ); | |
| 15 | + | |
| 16 | +if( $thumbnail_size === 0 ) { | |
| 17 | + $thumbnail_size = 'gamipress-points'; | |
| 18 | +} else { | |
| 19 | + $thumbnail_size = array( $thumbnail_size, $thumbnail_size ); | |
| 20 | +} | |
| 21 | + | |
| 22 | +// Get the last points type to show to meet if should append the separator or not | |
| 23 | +$last_points_type = key( array_slice( $a['points'], -1, 1, true ) ); ?> | |
| 24 | + | |
| 25 | +<span class="gamipress-inline-points-wrapper"> | |
| 26 | + | |
| 27 | + <?php foreach( $a['points'] as $points_type => $amount ) : | |
| 28 | + $label_position = gamipress_get_points_type_label_position( $points_type ); ?> | |
| 29 | + | |
| 30 | + <span class="gamipress-inline-points gamipress-inline-points-<?php echo $points_type; ?>"> | |
| 31 | + | |
| 32 | + <?php // Thumbnail | |
| 33 | + if ( $a['thumbnail'] === 'yes' ) : ?> | |
| 34 | + <span class="gamipress-inline-points-thumbnail gamipress-inline-points-<?php echo $points_type; ?>-thumbnail"><?php echo gamipress_get_points_type_thumbnail( $points_type, $thumbnail_size ); ?></span> | |
| 35 | + <?php endif; ?> | |
| 36 | + | |
| 37 | + <?php // Points label (before) | |
| 38 | + if ( $a['label'] === 'yes' && $label_position === 'before' ) : ?> | |
| 39 | + <span class="gamipress-inline-points-label gamipress-inline-points-<?php echo $points_type; ?>-label"><?php echo gamipress_get_points_amount_label( $amount, $points_type ); ?></span> | |
| 40 | + <?php endif; ?> | |
| 41 | + | |
| 42 | + <?php // Points amount ?> | |
| 43 | + <span class="gamipress-inline-points-amount gamipress-inline-points-<?php echo $points_type; ?>-amount"><?php echo gamipress_format_amount( $amount, $points_type ); ?></span> | |
| 44 | + | |
| 45 | + <?php // Points label (after) | |
| 46 | + if ( $a['label'] === 'yes' && $label_position !== 'before' ) : ?> | |
| 47 | + <span class="gamipress-inline-points-label gamipress-inline-points-<?php echo $points_type; ?>-label"><?php echo gamipress_get_points_amount_label( $amount, $points_type ); ?></span> | |
| 48 | + <?php endif; ?> | |
| 49 | + | |
| 50 | + <?php // Separator | |
| 51 | + echo ( $points_type !== $last_points_type ? '<span class="gamipress-inline-points-separator gamipress-inline-points-' . $points_type . '-separator">, </span>' : '' ); ?> | |
| 52 | + | |
| 53 | + </span> | |
| 54 | + | |
| 55 | + <?php endforeach; ?> | |
| 56 | + | |
| 57 | +</span> | |