Last active
August 29, 2015 13:56
-
-
Save hlashbrooke/8839033 to your computer and use it in GitHub Desktop.
Sensei - Check if a lesson has a quiz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if a lesson contains a quiz | |
* | |
* @param integer $lesson_id ID of lesson | |
* @return boolean True if lesson contains a quiz, false if not | |
*/ | |
if( ! function_exists( 'sensei_lesson_has_quiz' ) ) { | |
function sensei_lesson_has_quiz( $lesson_id = 0 ) { | |
if( $lesson_id ) { | |
$has_quiz = get_post_meta( $lesson_id, '_quiz_has_questions', true ); | |
if( $has_quiz ) { | |
return true; | |
} | |
} | |
return false; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment