• Resolved jloram

    (@jloram)


    Hey, sorry to bug you again.

    Is there a way to set this up so when a person opens the page, question #1 is already shown, vs the NEXT or START QUIZ button?

    Not super important, but I kind of like the idea of someone opening the page and getting hooked into playing immediately.

    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Harmonic Design

    (@harmonic_design)

    No worries; it’s an easy change.

    I’m guessing you have pagination enabled on your first question. Just disable pagination for your first question and it will show without needing a “next” button.

    If you display the first question instead of the START button, you’ll ask another question: “When does the timer start?”. When there is a START button, the timer is launched by the button.

    Just a suggestion to Harmonic Design: The duration is “decreasing” on the timer. So, it’s a point of view (the player tries to end the quiz before reaching the zéro). But other people will think: “I’d like to know how long it took to pass the quiz, because I’d like to improve my performance”.
    So, it could be a good idea to display the duration to pass the quizz for future developments (with a billboard of the winners), or to create an option for the payers.

    Thread Starter jloram

    (@jloram)

    So, I tried your suggestion before. Each question, except #1 paginated. I also had the questions set to be randomized. I still got a NEXT button on page 1, and in the middle of the quiz, the non-paginated question showed up with one of the paginated questions. There were two questions on that one page.

    Perhaps this was when I had the quizzes timed?

    Thread Starter jloram

    (@jloram)

    It is still happening. At least in the post preview.

    I have screen shots…can I post them?

    Plugin Author Harmonic Design

    (@harmonic_design)

    Ah, I didn’t know you were also randomizing. That complicates things because by the very definition of random, we cannot know which question will be the first question.

    I can send you a quick custom solution but need to know if your quizzes will be timed or not.

    Thread Starter jloram

    (@jloram)

    No, they are not timed.

    Questions randomized individually except #1. Answers randomized.

    Thank you.

    Thread Starter jloram

    (@jloram)

    BTW, yes, it does work without randomizing the question order.

    Plugin Author Harmonic Design

    (@harmonic_design)

    If you add the following to your theme’s functions.php file (remember to always backup the file before editing!), then your use case will work.

    What this does is check to see if pagination is enabled on whatever question appears first – meaning it will work even if you are randomizing question order. If the first is paginated, it will automatically “click” the next button to show the first question 🙂

    // if the first question in a quiz is paginated, click it automatically
    function hdq_click_first_next_if_first_q_paginated_jloram($quiz_ID)
    { ?>
    	<script>
    		function hdq_check_first_question_paginate(){
    			const wrap = document.getElementsByClassName("hdq_results_wrapper")[0];
    			const wrap_next = wrap.nextSibling.nextSibling;
    			if(wrap_next.classList.contains("hdq_jPaginate")){
    				wrap_next.firstChild.click();
    			}
    		}
    		setTimeout(hdq_check_first_question_paginate, 1000);
    	</script>
        <?php
    }
    add_action("hdq_after", "hdq_click_first_next_if_first_q_paginated_jloram", 1);
    Thread Starter jloram

    (@jloram)

    Thanks, this is boss.

    Will this disappear when I update my theme?

    If so, I may not want to deal with this and just keep the questions in the same order…random doesn’t really matter that much, ha ha.

    Thread Starter jloram

    (@jloram)

    Oh, and WHERE in the funtions.php? Anywhere?

    Plugin Author Harmonic Design

    (@harmonic_design)

    Since updating your theme is even an option, I’d say there is a very good chance that you are using a child theme (or at least, you should be). If you add the code to your child themes functions.php file, then you won’t need to worry about updating your theme overwriting your changes.

    The opening first line of your functions.php file should look like

    <?php

    paste the code I gave you after – on the second line. And since you’ve never done a modification to WordPress like this, I strongly recommend making a backup of the file just in case you make a mistake when doing this.

    Thread Starter jloram

    (@jloram)

    Thanks for this. I am not using a child theme. I started using this theme and started researching quiz plugins first, so I never took the time to do that. I will create a child theme before I set up that code you sent.

    And of course, I will back up the funtions.php file in cpanel before I go tinkering around in it.

    Thanks again, you’ve gone above and beyond.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Settings So Question 1 Appears?’ is closed to new replies.