/var/log

Quick Questionnaire

With the Quick Questionnaire WordPress plugin you can create simple questionnaires directly in the editor. I used it to create some exercises when I was teaching Dutch language to some foreign students.

Just add the answers to the end of the questions between double brackets. You can choose between text, radio and checkbox answers.

Example

The following list generates the questionnaire below:

  1. Capital of France? {text{ Paris }}
  2. What cities are capitals? {checkbox{ Amsterdam* | Paris* | Barcelona }}
  3. Capital of India? {itext{ New Delhi }}
  4. Which city is not a capital? {radio{ Amsterdam | Barcelona* | Paris }}
  5. Name capital of France or Italy? {reg{ /^(Paris|Rome)$/i }}

The resulting questionnaire:

  1. Capital of France?
  2. What cities are capitals?
  3. Capital of India?
  4. Which city is not a capital?
  5. Name capital of France or Italy?
  6. Capital of The Netherlands?

Question types

The text and itext types

The text and itext types display a textbox where a user can enter the correct answer(s). The itext type is case insensitive. For example:

Capital of France? {text{ Paris }}

You can also specify multiple correct answers:

Capital of France or Italy? {text{ Paris | Rome }}

The radio type

For multiple choice questions with one correct answer you use the radio type:

Which city is not a capital? {radio{ Amsterdam | Barcelona* | Paris }}

As you can see the correct answer is appended with a *.

The checkbox type

If there are more correct answers possible for a multiple choice question, you use the checkbox type:

What cities are capitals? {checkbox{ Amsterdam* | Paris* | Barcelona }}

The reg type

If you need some very specific validation for the correct answer, you can use the reg type with a valid regular expression:

Name capital of France or Italy? {reg{ /^(Paris|Rome)$/i }}

Configuration

By default this plugin enables the block for only the Quick Questionnaire post type. If you want to enable it for all post types, add this to wp-config.php:

define('QQ_ALL_POSTS', true);

In the Gutenberg block you can select the following properties:

  • Show button - show or hide a Show button that displays the correct answers.
  • Ordered - switch between ordered and unordered list.

Some other properties of this plugin:

  • The correct answers are validated server side, so they aren't accessible on the client.