Use of any code provided by Harmonic Design or HDPlugins.com is at your own risk. It is ALWAYS recommended to backup your site or files before modifying any code on your site. Copy Code
// Tell HD Quiz to run a custom function once the quiz starts
function hdq_Thorsten_init($quizOptions)
{
array_push($quizOptions->hdq_init, "hdq_Thorsten_init_action");
return $quizOptions;
}
add_action('hdq_init', 'hdq_Thorsten_init');
// add custom JS function to quizzes that runs on quiz init
function hdq_Thorsten_after_content()
{
?>
<script>
function hdq_Thorsten_init_action() {
const start = document.getElementsByClassName("hdq_quiz_start");
if (!start || start.length == 0) {
return;
}
start[0].addEventListener("click", function() {
const el = document.getElementsByClassName("hdq_before_image");
for (let i = 0; i < el.length; i++) {
el[i].style.display = "none";
}
});
}
</script>
<?php
}
add_action('hdq_after', 'hdq_Thorsten_after_content');