Skip to content

Instantly share code, notes, and snippets.

@NikV
Created September 8, 2015 03:22
Show Gist options
  • Save NikV/769e46eeedb84170683c to your computer and use it in GitHub Desktop.
Save NikV/769e46eeedb84170683c to your computer and use it in GitHub Desktop.
Example for how to use the gquiz_answer_indicator filter
//advanced - more control
add_filter( 'gquiz_answer_indicator', 'gquiz_answer_indicator', 10, 7);
function gquiz_answer_indicator ($indicator_markup, $form, $field, $choice, $lead, $is_response_correct, $is_response_wrong){
if ( $is_response_correct )
$indicator_markup = ' (you got this one right!)';
elseif ( $is_response_wrong ) {
if ( $field['inputType'] == 'checkbox' && rgar( $choice, 'gquizIsCorrect' ) )
$indicator_markup = ' (you missed this one!)';
else
$indicator_markup = ' (you got this one wrong!)';
} elseif ( rgar( $choice, 'gquizIsCorrect' ) ){
$indicator_markup = ' (this was the correct answer!)';
}
return $indicator_markup;
}
@certainlyakey
Copy link

This seems to be not working, because the indicator image is actually hardcoded in plugin JS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment