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 / single-achievement.php

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

197 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Single Achievement template
4 *
5 * This template can be overridden by copying it to yourtheme/gamipress/single-achievement.php
6 * To override a specific achievement type just copy it as yourtheme/gamipress/single-achievement-{achievement-type}.php
7 */
8 global $gamipress_template_args;
9
10 // Shorthand
11 $a = $gamipress_template_args;
12
13 // Check if user has earned this Achievement, and add an 'earned' class
14 $earned = gamipress_has_user_earned_achievement( get_the_ID(), get_current_user_id() );
15
16 // Setup achievement classes
17 $classes = array(
18 'single-achievement',
19 'achievement-wrap',
20 ( $earned ? 'user-has-earned' : '' ),
21 'gamipress-layout-' . $a['layout'],
22 'gamipress-align-' . $a['align']
23 );
24
25 /**
26 * Single achievement classes
27 *
28 * @since 1.4.0
29 *
30 * @param array $classes Array of achievement classes
31 * @param integer $achievement_id The Achievement ID
32 * @param array $template_args Template received arguments
33 */
34 $classes = apply_filters( 'gamipress_single_achievement_classes', $classes, get_the_ID(), $a ); ?>
35
36 <?php // Check if current user has earned this achievement
37 echo gamipress_render_earned_achievement_text( get_the_ID(), get_current_user_id() ); ?>
38
39 <div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
40
41 <?php
42 /**
43 * Before single achievement
44 *
45 * @since 1.0.0
46 *
47 * @param integer $achievement_id The Achievement ID
48 * @param array $template_args Template received arguments
49 */
50 do_action( 'gamipress_before_single_achievement', get_the_ID(), $a ); ?>
51
52 <div class="gamipress-achievement-image">
53 <?php // Thumbnail
54 echo gamipress_get_achievement_post_thumbnail( get_the_ID() ); ?>
55
56 <?php // Share
57 echo gamipress_achievement_share_markup( get_the_ID(), $a ); ?>
58 </div>
59
60 <?php
61 /**
62 * After single achievement thumbnail
63 *
64 * @since 1.0.0
65 *
66 * @param integer $achievement_id The Achievement ID
67 * @param array $template_args Template received arguments
68 */
69 do_action( 'gamipress_after_single_achievement_thumbnail', get_the_ID(), $a ); ?>
70
71 <div class="gamipress-achievement-description">
72
73 <?php // Points of the achievement
74 echo gamipress_achievement_points_markup( get_the_ID(), $a ); ?>
75
76 <?php
77 /**
78 * After single achievement points markup
79 *
80 * @since 1.0.0
81 *
82 * @param integer $achievement_id The Achievement ID
83 * @param array $template_args Template received arguments
84 */
85 do_action( 'gamipress_after_single_achievement_points', get_the_ID(), $a ); ?>
86
87 <?php // Achievement content
88 if( isset( $a['original_content'] ) ) :
89 echo wpautop( $a['original_content'] );
90 endif; ?>
91
92 <?php // Times earned
93 if ( (bool) gamipress_get_post_meta( get_the_ID(), '_gamipress_show_times_earned' ) ) :
94
95 echo gamipress_achievement_times_earned_markup( get_the_ID(), $a );
96
97 /**
98 * After achievement times earned
99 *
100 * @since 1.5.9
101 *
102 * @param integer $achievement_id The Achievement ID
103 * @param array $template_args Template received arguments
104 */
105 do_action( 'gamipress_after_single_achievement_times_earned', get_the_ID(), $a );
106
107 endif; ?>
108
109 <?php // Global Times earned
110 if ( (bool) gamipress_get_post_meta( get_the_ID(), '_gamipress_show_global_times_earned' ) ) :
111
112 echo gamipress_achievement_global_times_earned_markup( get_the_ID(), $a );
113
114 /**
115 * After achievement times earned by all users
116 *
117 * @since 2.0.0
118 *
119 * @param integer $achievement_id The Achievement ID
120 * @param array $template_args Template received arguments
121 */
122 do_action( 'gamipress_after_single_achievement_global_times_earned', get_the_ID(), $a );
123
124 endif; ?>
125
126 <?php
127 /**
128 * After single achievement content
129 *
130 * @since 1.0.0
131 *
132 * @param integer $achievement_id The Achievement ID
133 * @param array $template_args Template received arguments
134 */
135 do_action( 'gamipress_after_single_achievement_content', get_the_ID(), $a ); ?>
136
137 <?php // Include output for our steps
138 echo gamipress_get_required_achievements_for_achievement_list( get_the_ID() ); ?>
139
140 <?php
141 /**
142 * After single achievement steps
143 *
144 * @since 1.0.0
145 *
146 * @param integer $achievement_id The Achievement ID
147 * @param array $template_args Template received arguments
148 */
149 do_action( 'gamipress_after_single_achievement_steps', get_the_ID(), $a ); ?>
150
151 <?php // Achievement unlock with points
152 echo gamipress_achievement_unlock_with_points_markup( get_the_ID(), $a ); ?>
153
154 <?php // Include achievement earners, if this achievement supports it
155 if ( (bool) gamipress_get_post_meta( get_the_ID(), '_gamipress_show_earners' ) ) :
156
157 $maximum_earners = absint( gamipress_get_post_meta( get_the_ID(), '_gamipress_maximum_earners' ) );
158
159 echo gamipress_get_achievement_earners_list( get_the_ID(), array( 'limit' => $maximum_earners ) );
160
161 /**
162 * After single achievement earners
163 *
164 * @since 1.0.0
165 *
166 * @param integer $achievement_id The Achievement ID
167 * @param array $template_args Template received arguments
168 */
169 do_action( 'gamipress_after_single_achievement_earners', get_the_ID(), $a );
170
171 endif; ?>
172
173 <?php
174 /**
175 * Single achievement description bottom
176 *
177 * @since 1.4.0
178 *
179 * @param integer $achievement_id The Achievement ID
180 * @param array $template_args Template received arguments
181 */
182 do_action( 'gamipress_single_achievement_description_bottom', get_the_ID(), $a ); ?>
183
184 </div><!-- .gamipress-achievement-description -->
185
186 <?php
187 /**
188 * After single achievement
189 *
190 * @since 1.0.0
191 *
192 * @param integer $achievement_id The Achievement ID
193 * @param array $template_args Template received arguments
194 */
195 do_action( 'gamipress_after_single_achievement', get_the_ID(), $a ); ?>
196
197 </div><!-- .achievement-wrap -->