Creating a Conditional Quiz Plugin in WordPress

You might have heard about online quizzes that are dynamic in nature, like giving tests, surveys etc. Users have been participating in a lot of online quizzes to achieve this objective.Using WordPress we can create such a quiz that is adaptive in nature.

Image Courtesy: http://aaaabacus.org

For Example:

There will be multiple choice questions in this Quiz and instead of having single correct answer to the question, we will have weightage for each answer. Once the quiz is set up, we’ll associate personality type for various range of scores and store that in the database. Example:

-If a User scores between 80 to 100 range, he will be assigned Personality Type A.

-Similarly if a User scores between 80 to 60 range, he will be assigned Personality Type B.

-If a User Scores between 60 to 40 range, he will be assigned Personality Type C.

And so on !

When the user completes the quiz and submits it, the system will calculate user’s overall score and compare with the score stored in the database and then display the result to user. The user can also share results on social networking site if he wants.

The WordPress plugin to setup this kind of conditional Quiz will have the following architecture:

The plugin menu in dashboard will allow admin to post his personalized questions. Admin can also create multiple test papers by adding different questions to different test papers.

On every question, we will create a metabox that allows the administrator to add answers to the respective question. Here the administrator can also assign points to every answer.

There’s also a caching feature which assigns each answer choice a score of: 5, 10, 15, and 20. When user completes the test, based on his responses, total score will be calculated and on that score the user’s personality will be decided!

The selected test paper is displayed on the front end.

There is a combination of score and personality type in a database already which compares the user score with database values and the result will then be displayed.

If the user wants to share the quiz results on a social networking site, a check box appears asking the user if the user wants to post the response to Facebook or Twitter. User will only need to paste this short code on a particular page to display the test. The plug-in will create a short code to display the test on front end which the user will need to paste on a particular page to display the test.