@@ 290-308 (lines=19) @@ | ||
287 | * @return mixed The HTML markup for difficulty or false if not set. |
|
288 | * @uses Game\get_difficulties |
|
289 | */ |
|
290 | function get_difficulty( $game_id ) { |
|
291 | if ( $difficulty = get_post_meta( $game_id, '_gc_difficulty', true ) ) { |
|
292 | ob_start(); ?> |
|
293 | <span class="gc-icon icon-game-difficulty"><?php the_svg( 'difficulty', false ); ?></span><span class="game-difficulty" id="game-<?php echo absint( $game_id ); ?>-difficulty"><?php echo esc_html( Game\get_difficulties( $difficulty ) ); ?></span> |
|
294 | ||
295 | <?php $output = ob_get_clean(); |
|
296 | ||
297 | /** |
|
298 | * Allow the difficulty output to be filtered (but only if it has been set). |
|
299 | * |
|
300 | * @since 1.0.0 |
|
301 | * @var string The HTML markup for difficulty. |
|
302 | * @uses Game\get_difficulties |
|
303 | */ |
|
304 | return apply_filters( 'gc_filter_difficulty', $output ); |
|
305 | } |
|
306 | ||
307 | return false; |
|
308 | } |
|
309 | ||
310 | /** |
|
311 | * Return the game playing time. |
|
@@ 317-334 (lines=18) @@ | ||
314 | * @param int $game_id The game's post ID. |
|
315 | * @return mixed The HTML markup for playing time or false if not set. |
|
316 | */ |
|
317 | function get_playing_time( $game_id ) { |
|
318 | if ( $playing_time = get_post_meta( $game_id, '_gc_time', true ) ) { |
|
319 | ob_start(); ?> |
|
320 | <span class="gc-icon icon-game-time"><?php the_svg( 'time', false ); ?></span><span class="game-playing-time" id="game-<?php echo absint( $game_id ); ?>-playing-time"><?php echo esc_html( sprintf( __( '%s minutes', 'games-collector' ), $playing_time ) ); ?></span> |
|
321 | ||
322 | <?php $output = ob_get_clean(); |
|
323 | ||
324 | /** |
|
325 | * Allow the playing time output to be filtered (but only if it has been set). |
|
326 | * |
|
327 | * @since 1.0.0 |
|
328 | * @var string The HTML markup for playing time. |
|
329 | */ |
|
330 | return apply_filters( 'gc_filter_playing_time', $output ); |
|
331 | } |
|
332 | ||
333 | return false; |
|
334 | } |
|
335 | ||
336 | /** |
|
337 | * Return the game age. |
|
@@ 343-360 (lines=18) @@ | ||
340 | * @param int $game_id The game's post ID. |
|
341 | * @return mixed The HTML markup for age or false if not set. |
|
342 | */ |
|
343 | function get_age( $game_id ) { |
|
344 | if ( $age = get_post_meta( $game_id, '_gc_age', true ) ) { |
|
345 | ob_start(); ?> |
|
346 | <span class="gc-icon icon-game-age"><?php the_svg( 'age', false ); ?></span><span class="game-age" id="game-<?php echo absint( $game_id ); ?>-age"><?php echo esc_html( sprintf( '%d+', $age ) ); ?></span> |
|
347 | ||
348 | <?php $output = ob_get_clean(); |
|
349 | ||
350 | /** |
|
351 | * Allow the age output to be filtered (but only if it has been set). |
|
352 | * |
|
353 | * @since 1.0.0 |
|
354 | * @var string The HTML markup for age. |
|
355 | */ |
|
356 | return apply_filters( 'gc_filter_age', $output ); |
|
357 | } |
|
358 | ||
359 | return false; |
|
360 | } |
|
361 | ||
362 | /** |
|
363 | * Enqueue front end styles and scripts. |