PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 7.9.8
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v7.9.8
8.0.4 8.0.3 8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 7.8.7 All 46 releases
gamipress / templates / inline-points.php

inline-points.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 7.9.8, at templates/inline-points.php

58 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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>&nbsp;
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>&nbsp;
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 &nbsp;<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>
58