I’m using a pool of questions and loading 5 at a time.
Is there a way to have a “load new quiz” or “load next quiz” link or something like that in the results box? If so, that would nice. Otherwise, I guess users need to reload the webpage itself using the browser’s refresh button, right? Is there another option I’m not seeing?
I’m just looking for an elegant way to keep people loading new quizzes and learning new stuff.
The best way is to probably just add a button/link to the results text (the pass and fail results text) that links back to the page. So you create a link back to the quiz that says “retake quiz” or similar, and when a user selects it, the page reloads with a new set of questions 🙂
I’m unclear on how I would link to the “results text?” Keep in mind that my quiz is just one piece of content on a webpage with multiple pieces of content, not a stand-alone webpage.
Thanks for al your help!
This is still possible.
Browsers can use something called anchors to auto-scroll to a specific place on a page. As long as your site doesn’t do something to break this of course.
HD Quiz wraps quizzes inside unique IDs that we can use for this very purpose. The ID is
IDis the ID number of the quiz (this can be seen inside the shortcode for each quiz).
So for example, if your quiz ID is 7, then the anchor ID that we can use will be
So let’s pretend that the page with a quiz is
https://domain.com/quiz. What you do is add a link to the results text that points to
htps://domain.com/quiz#hdq_7. This way once the page reloads, the browser will automatically scroll to the quiz.
Real case example: Clicking here will reload THIS support page, but auto scroll to your last message. *NOTE: when using this technique, you may want to open the link in a new window/tab. This way the current page doesn’t just scroll.
Thanks for the support!
I followed these instructions making the target of the link “_blank” and when I click on the button I created, it simply scrolls up the page to the top of the quiz I just took, and doesn’t open a new quiz on a new tab. Hmmm.
The only two possibilities are that you either incorrectly added in the target _blank or something on your site (theme or plugin) is “link highjacking” and stopping it from loading in a new tab. I really can’t help more unless I can see a link to the quiz though since there is no way for me to narrow it down
Here’s the code I see using Inspector on my webpage. Unfortunately, my site is on my local host and not something I can share a link to (yet).
I see its targeting a blank page, but it doesn’t work.
I’m just going to assume that you have your link properly formatted then. This also means that I unfortunately cannot really help you further. A link not opening in a new window is completely unrelated to HD Quiz and without being able to see the page myself, there is nothing I can do to help debug or track the cause for you.
At this point, the only advice I can give is the following.
1) Make sure it’s not a popup blocker or something like that.
2) Try the generic WordPress debug steps. (switch themes to rule out your theme, disable all plugins except HD Quiz, then re-enable one by one until the problem comes back).
Assuming that once again, you correctly made your link and that the new window is not being blocked by a popup blocker or something, this means that something on your site is link hijacking (hooking into link clicks to change the default behavior) – which is something that no code should EVER globally do. So if you track down either a feature of your theme or another plugin as the cause, I strongly recommend disabling that feature/plugin.
If not, the worst-case scenario is that you create it as a normal link (without the quiz ID) so that the page refreshes, but the user has to scroll back to the quiz. Maybe you can place a scrollable link to the quiz at the top of the page for quicker access.
Thanks for the excellent support and generosity of your time. I greatly appreciate it.
I tested with another theme and it worked.
I switch back to my theme and then created a link via text, rather than a button and it opened in another tab! 🙂
Thanks again for the great support and plugin! 🙂
I thinks this question is excellent (in my case). I did not dare to ask it! But now I dare…
I’m not a developer, but i found a code called “location.reload();”.
Is it possible to include this code inside your plugin tu create a button in the “Quiz Pass” and “Quiz Fail” final window ?
It could be more convenient (in my case) than to copy-past lots of different URL changing if I rewrite URLs a day (for SEO).
In my quizzes, I added a text in the final window : ” ↺ Actualisez la page pour un nouveau quiz”. But I’m really not proud of that 🙁
Thanks for your suggestions,
@michel92 always feel safe to dare!
For the first, an example would be
<a href = "#" onClick = "location.reload();">Look at me!</a>
Just note that the above may have conflicts with your theme, which if is the case you’ll need to use the eventListener method (i can provide instructions if it comes to this)
- You must be logged in to reply to this topic.