Create a calculated survey which leads to a result page or post


Create a calculated survey which leads to a result page or post

Let’s imagine you want to create poll, which forwards the visitor after a specific page that corresponds to the poll results: SQuiz3 is able to solve this.
Scenario can be: You want to show visitors how healthy his diet is.

Step 1

Create new questions as multiple choice questions where the correct checkbox is unchecked – we don’t have to proof the users answer.w e will only count occurence of certain values.
So important is the field ‘Special Value’ in each answer.


You see here the special values from a to d. At the end Squiz will count occurences of these values and will redirect to the relevant page corresponding to this value. Next step will show the setup of the survey.

Step 2

Create posts (or pages) for every possible result of this survey. That means a post for majority of a, b, c and d. Additionally you need a post for results that are ambiguous. That means result has equal counts for more than two values.

Step 3

Create a survey as usual but give following additional inputs:


Set the switch ‘Calculated Survey’ to on. Save it, add your questions and the button labels:


And now the important part: Set posts or pages as target for the special values:


Now save this survey and insert the shortcode in a page or post.

The result:

How Healthy is your diet?

Please select an option
Please answer the following questions about your daily diet. We will show you at the end, how healthy it is.


Survey Sample

Squiz Survey

Please select an option
An Example for little survey to collect users impressions and experience with SQuiz.

Quiz Sample

This is an quiz example.

A Fast Coding Quiz

You must select an answer
This quiz tests your php coding skills. Just three question in 60 seconds.

The passing score is 50%.

And here comes the top ten list for the quiz:

Topten list for A Fast Coding Quiz

Correct AnswersPercentageDate
1 5 100 2016-08-09 20:13:38
2 5 100 2016-08-17 14:34:27
3 4 80 2016-09-02 12:57:50
4 4 80 2016-08-12 09:51:06
5 4 80 2016-08-11 18:37:40
6 4 80 2016-08-09 21:01:21
7 4 80 2017-05-04 13:17:39
8 3 60 2016-09-12 11:42:28
9 2 40 2016-08-11 06:21:31
10 2 40 2016-09-29 07:53:34

Creating Questions

Choose New Question from the SQuiz menu.

You will get the edit form with a popup which prompts you to select a question type.

2016-08-10 15_09_41-Edit Question-choose type

After that the page will reload and gives you the correct form for your question type. You can’t change the question type after this decision.

Fill the basic data: type your question, category and maybe explanation and save the question. You cannot add answers before saving the question.

Then click the Add Answer button (if present). Depending on question type you have following options:

Answers for Choice Questions

2016-08-10 15_21_35-Edit Question addanswerssinglemulti

You will get an empty answer in the list. Clicking the edit icon in the left top corner will open a modal box with the visual editor to edit the text or media. You can mark this answer as correct by checking the box on the left side.

If you mark more than one answer as correct the question will be a multi choice question in frontend.

You can drag and sort the answers. This would be the order on frontend.

After each change the Save Answers button will appear. You must save them explicit. Update question if you are ready with all.

Answers for Order Questions

2016-08-10 15_26_20-Edit Question addanswer-order

Everything similar to choice questions but you will get no correct box as all answers are correct. You must sort them in the order you expect to be the question recognized as correct. In frontend SQuiz will randomize the order for the quiz player.

Answer for Cloze Questions

2016-08-10 15_29_22-Edit Question addanswer cloze

There is no answer in common sense but the cloze text. You get the visual editor and type your text as usual. Now you enclose all words with |* and *| (pipe asterisk and asterisk pipe) the user must input in frontend. SQuiz will replace this words with input fields, every field as long as the longest gap. In evaluation the words will be compared in the order they found in the text.

Answer for Text Question

2016-08-10 15_32_51-Edit Question addanswer-text

The text question only have one string as answer. You cannot use html to format this because evaluation would not be possible. Input here the text you expect as answer from the user exactly in spelling, indentation lower and upper case. This is important, because SQuiz compares the user answer and your text character by character on exact equality. Answer will only recognized as correct if both are exact equal.

Building Quizzes with SQuiz3

To start all kinds of items find the SQuiz menu on top of the WordPress menu.

2016-08-17 09_49_16-SQuiz Menu

Select New SQuiz Item. The form will open and you must input the basic data. That is:

  1. a title
  2. item type and template
  3. button labels ( bottom of the page )
  4. decide if you want to randomize questions, show review at end (only quizzes), time limit and passing score.

2016-08-17 09_53_46-Edit SQuiz Item Type and Template

After that you have to save the quiz otherwise you cannot add questions.

You should have already created some questions for your quiz, otherwise you must do that now.

Adding Questions

2016-08-10 15_03_48-Edit SQuiz Item-question_map

Questions on the left side are available, on the right already assigened to this quiz. Simply drag questions to the right to add them, click the remove button in the upper right corner to remove them from the list.

You can filter the available questions by category and type. Every update of this list will be saved dynamically by AJAX.

In case of polls you can add more than one question, but this don’t has any effect to the frontend: Only the first question will be available for the visitor.


You can add some information and text add the end. Use following placeholders to insert information:

  • {passing score} : Predefined passing score
  • {result score} : Predefined passing score
  • {correct} : Correct answered questions
  • {question count} : Overall question count
  • {question answered} : Answered questions by user
  • {time} : Time user needed to complete the quiz

2016-08-17 10_58_36-Edit SQuiz Item Quiz ending

If you leave this empty, nothing will be displayed after voting.

An optional review button will be added automatically if you check ‘Show Review’ in quiz options


SQuiz3 and sk-library Installation

The download archive contains to plugins: SQuiz3 and sk-library.
You must install both within the wordpress plugin panel. Activate first sk-library and then SQuiz3. Activation process of SQuiz3 will install the necessary database tables.

SQuiz 3 contains an update checker so that you will be informed about plugin or library updates.


For all purchasers of WP SQuiz in older versions (2.x): You MUST deactivate and delete the SQuiz and SQuiz User Plugin. Old and new Version are not compatible.

Deleting the old version don’t affect the database so that you can import old quizzes to the new plugin. An update script will be available soon.



SQuiz 3 uses the TWIG template engine. Most outputs are generated by the template engine so that you are able to customize it by creating your own templates.

Quiz items will get the template parameter through settings in the quiz edit page.

Templates for emails send from Evaluation area can be selected in the options menu on the result detail page.

All templates are located in /SQuiz/templates, quiz item templates have own folders with multiple template files for each layout part. A full set for quizzes look like this:

2016-08-16 12_33_17-squiz3-standard-template

If you want to build your own you have not to create each template part. All parts you omit will be searched in /standard. Learn more about Template Overloading.

Basically contain templates simple html code. Every dynamic output generated by php is enclosed with double curly braces {{ my_var }}.

Every programatically stuff is enclosed in curly braces and percent signs. For example:

<div class="squiz_checkbox_container">
    <input type="checkbox" name="quizdata[question_{{ }}_{{ }}]"
               id="quizdata_question_{{ }}_{{ }}"
               data-question="{{ }}"
               class="squiz_checkbox squiz_hide" value="{{ }}" />
    <label for="quizdata_question_{{ }}_{{ }}" class="squiz_label squiz_label_checkbox">
        {{ answer.text|raw }}

This is the answer_checkbox template. You can make a copy into a new folder and change everything in this template but you must include the dynamic outputs as seen in the example above. If there is something missing like data-question tag or name tag of the input field the quiz item won’t work.

As you can see in the label tag there is as content answer.question and divided by a pip a modifier ‘raw’. This causes the text is displayed as is – html code will be put out  as html and not as text.

Be careful: Do not customize basic templates delivered with this plugin.The next update will override your changes. Make a copy of an email template respectively copy a folder and make your additions or changes there.

More about Twig can be found here.


There are two shortcodes available:

  1. ([) squiz id=3(]) and
  2. ([) squiz-topten id=3 count=10 month=2 year=2016 show_user=1(])

1.) This is the basic shortcode to display all kinds of items and it takes no other arguments than the item (quiz) id. It will display the item using the predefined template.

2.) To display a list of participations use this shortcode whereby following arguments are allowed:

  • id = the item id
  • count = integer number of entries to display
  • month = integer the month of participation
  • year = the full year of participation
  • show_user = integer (0/1) show the user name or not (=0)

You can omit every argument except the id. Default values will be:

count = 10
show_user = 1
month and year = 0 (show all)

To display the list the template named top_ten.twig is used.

Discover more about Templates and Template Overloading.


New Features

As we said, there are a lot of new features in SQuiz 3. See them here in detail:

New Items: Polls and Surveys

First to say there are two new item types: surveys and polls. They are slightly different from quizzes. Polls could have only one choice question (btw. you can add more but they won’t be visible), surveys have only a aggregated evaluation. You drill down to a single users participation. Beside that polls show up only if the user not already voted (today) this poll, otherwise the result is shown directly.

2016-08-12 19_34_09-SQuiz 3 –poll result

Surveys in opposite to quizzes can’t have a review at end.

New Question Types: Plain Text and Cloze Text

We added a plain text question where the user must type word by word – character by character exactly what you defined in the question editor. But more important is the usage of this type in surveys. There user can input free text as they like.

The new cloze text question type will enhance your quizzes. You can write long texts with so much gaps as you need. The user input will be compared character by character for each gap and the user gets only his point if all gaps are correctly filled in.

Rewritten: Review Mode

The review mode is completely rewritten and enhanced. If you set ‘Show Review’ to ‘on’ in the quiz editing page users get at the end a review button. By clicking this they can go through the complete list of questions, see their answers and the correct ones and additionally an explanation (but only if you wrote one).

2016-08-16 13_17_19-PHP Quiz – Review - Skurrilewelt

New: Explanations

Questions now can have an explanation text. This text will be used in reviews to explain the question in detail (if you want that)

2016-08-16 13_12_06-PHP Quiz - Review – Skurrilewelt

New: Templates

The quiz, survey or poll output on the screen is generated by the template engine Twig. The plugin contains a set of three templates for the three item types.

Customizing this is easier as you think: In most cases a new css file with a few styles is enough to create your unique look. Therefor it is sufficient to create a new template folder (yes: empty!) and the stylesheet in another specified folder. Ready with that. The template engine loads missing templates from the standard folder – you must not care about that. For more information please read the docs.

Better: Item editing

A new question section in the quiz editing view facilitates the selection of questions and improves clarity. Questions and associated filter buttons are colored, additionally you filter by category as combined filters.

Editing answers is also improved: you get to edit responses the visual editor so that now HTML and media files possible answer content.

2016-08-10 15_03_48-Edit SQuiz Item-question_map

Statistics and Evaluation

The stats section is completely renewed. All item types have their specific evaluation.

Quizzes are well organized in a accordion and in there a  sortable table with pagination and filter with the participations. Every participation can be viewed in a details version and gives you information about all questions a user answered, if he has passed or not and so on. You can mail this detail view directly to the user if you like.

All tables and evaluations can be exported with a single click to csv. You can choose between export of a filtered list or the complete result list.

2016-08-12 07_59_21-Statistics Quiz

2016-08-12 08_03_43-Statistics Export Options

Quiz evaluation can be drilled down to a single user participation. You can see a complete review of a single quiz on one page. Additionally you can send a copy of that via email to the user.

2016-08-17 08_04_42-Statistics singel quiz user details

As you see above you can choose between two export options:

Popup and Mail

The popup will give you the html markup as seen on this page. The mail option sends an email build on choosen template ( see Templates ) to the specified email address. If a logged in user makes a quiz his data will be available here otherwise you have to input data manually.

If you have any suggestions about new features please leave a comment.