QuickenLoans/SlickQuiz-WordPress — pull request #33 by mirgcire (2014-09-03 18:20:10+00:00)
Title: Supporting shortcodes in questions

I propose to implement shortcode support in questions. This is very useful for language quizzes, where the question could contain a recording, but there must be other uses as well.

I found that this result can be achieved by adding the following code to line 72 of slickquiz-front.php

$json = json_decode ($quiz->publishedJson);
foreach ($json->questions as $index => $question)
{
$expanded = do_shortcode($question->q);
$json->questions[$index]->q = $expanded;
}
$quiz->publishedJson = json_encode ($json);

This should also be added slickquiz-preview.php, but I haven't tried that out yet.

An enhancement to this would be to support nested short codes by putting the code in a function and calling it from a loop, which terminates when the return value of the function is the same as the input.

BTW, I am new to GitHub so I have no idea about the etiquette of making pull requests.