Skip to content

Instantly share code, notes, and snippets.

@hlashbrooke
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hlashbrooke/8839033 to your computer and use it in GitHub Desktop.
Save hlashbrooke/8839033 to your computer and use it in GitHub Desktop.
Sensei - Check if a lesson has a quiz
<?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