HD Quiz

Need to send invoices?
Check out my new WordPress plugin HDInvoice
Limited time launch sale

Is there a way to start the quiz directly without “NEXT”?

Published: March 6, 2024
Support status: closed

Hi, I started to use you plug-in. Very well done! Thanks. I am going to buy the addon but before, I was wondering if it was possible to start the embed quiz directly without clicking on next. Thank you

thread author: carole

Hi Carole,
Quizzes only start with the next button if your first question has paginate enabled.

Just uncheck paginate from your first question and you’ll be good to go.

The only exception is of you are using random question order. Let me know if you are and I can send you some custom code to auto click the next button on load.

06 March 2024 — 22:41 support admin - Dylan

Ah perfect. Thank you for you quick answer. Just benchmark all the other solutions and yours is perfect for my project! Happy to see that you are so reactive with support. Will I get a receipt when I buy the addons? thank you in advance

06 March 2024 — 22:46 thread author - carole

You sure will!

You will get an order email confirmation will all relevant information. The order page itself will also contain all the info you need. You can print the order page (it has a custom print view) or “print to pdf” as needed.

07 March 2024 — 17:47 support admin - Dylan

Hello Dylan, do you still have the custom code to auto click the “next” button on load available? I ran into the same issue as Carole but I have the random question order enabled. Thanks a lot!

20 June 2024 — 10:28 Martin

@Martin,
the following code should work. Just note that this assumes that ALL of your quizzes will have the first question paginated. This code will always click the first next button on quiz load, regardless of where that next button may be located.

function hdq_add_first_next_click_init_action($data)
{
    array_push($data->hdq_init, "hdq_auto_click_first_next_button_when_random");
}
add_action("hdq_init", "hdq_add_first_next_click_init_action", 10, 1);

function hdq_auto_click_first_next_button_when_random()
{
?>
    <script>
        function hdq_auto_click_first_next_button_when_random() {
            const jPaginateEls = document.getElementsByClassName("hdq_next_button");
            if (jPaginateEls.length == 0) {
                return;
            }
            jPaginateEls[0].click();
        }
    </script>
<?php
}
add_action("hdq_after", "hdq_auto_click_first_next_button_when_random");

The first function tells HD Quiz to run a JavaScript function once HD Quiz has loaded. The second function is the actual function that auto clicks the first next button.

This code should be added to your theme’s functions.php file. BACK UP THE FILE FIRST

20 June 2024 — 11:24 support admin - Dylan

Respond to thread

This thread has been closed / marked as resolved.
You can reply to this thread, but it might be better to start a new thread if you need help
.

You can also upload images to imgur and paste the links here. Just make sure that your images don't include any sensitive information.

Submit