PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.5
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.5
8.0.5 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 All 47 releases
← All changes | integrations/qsm/includes/functions.php +44 -0 7.8.9 → 8.0.5 View file →
@@ -1,0 +1,44 @@
1 +<?php
2 +/**
3 + * Functions
4 + *
5 + * @package GamiPress\QSM\Functions
6 + * @since 1.0.0
7 + */
8 +
9 +// Exit if accessed directly
10 +if( !defined( 'ABSPATH' ) ) exit;
11 +
12 +/**
13 + * Get the quiz post ID
14 + *
15 + * @since 1.0.0
16 + *
17 + * @param int $quiz_id
18 + *
19 + * @return int
20 + */
21 +function gamipress_qsm_get_quiz_post_id( $quiz_id ) {
22 +
23 + // False if no quiz ID provided
24 + if( !isset( $quiz_id ) ) {
25 + return false;
26 + }
27 +
28 + $post_id = get_posts( array(
29 + 'posts_per_page' => 1,
30 + 'post_type' => 'qsm_quiz',
31 + 'post_status' => array( 'publish' ),
32 + 'fields' => 'ids',
33 + 'meta_query' => array(
34 + array(
35 + 'key' => 'quiz_id',
36 + 'value' => $quiz_id,
37 + 'compare' => '=',
38 + ),
39 + ),
40 + ) );
41 +
42 + return $post_id;
43 +
44 +}