Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Create mini Quiz with one Word and three possible Definitions WordPress


I would like to create a quiz similar to "Our Quiz" at [[LINK href=""]][[/LINK]] where people can click a synonym or definition for a word as the correct answer. Every time the page reloads a new word + possible definitions is loaded. When a possible definition is clicked a popup - jQuery - shows you if the answer is correct or not. It also offers to load another quiz word when the answer was correct. Question is, how to do this in a convenient way in WordPress?

Answers (4)


Abdessamad Idrissi answers:

You would do this in 4 steps:
1. Create a page template for your <em>word-of-the-day</em> page by inserrting in your functions.php this code:

// Prepare the page
$my_page = array(
'post_status' => 'publish',
'post_type' => 'page',
'post_author' => 1,
'post_name' => $page["post_name"],
'post_title' => $page["post_title"]

// Insert the page into the database
$page_id = wp_insert_post($my_page);

// Assign the page template to the new page
update_post_meta($page_id, '_wp_page_template', 'word-of-the-day.php');

2. Inside your theme create a file with name <em>word-of-the-day.php</em>

3. In <em>word-of-the-day.php</em> you will need to: get random post and get fake posts too by using :
<ul id="quiz">

// save its ID
$question_id = '';

// get the question word
query_posts( 'orderby=rand&posts_per_page=1' );
if ( have_posts() ) :
while ( have_posts() ) : the_post();
$question_id = get_the_ID();
?><li>What does it mean <a href="<?php the_permalink(); ?>" class="question"><?php the_title() ?></a>?</li><?php

// reset the previous query

// get 2 fake answers
$args = array( 'numberposts' => 2, 'exclude'=> $question_id );
$fake_answers = get_posts( $args );

// Now prepare the answers
echo '<ul id="sub_quiz">';

$args = array(
'orderby' => 'rand',
'post__in' => array($question_id, $fake_answers[0]->ID, $fake_answers[1]->ID),
'posts_per_page' => 3

query_posts( $args );
if ( have_posts() ) :
while ( have_posts() ) : the_post();
?><li>.<a href="#" class="answer" <?php if(get_the_ID() == $question_id) echo 'id="correct"'; ?>'><?php the_content(); ?></a></li><?php

echo '</ul';

4. Add a jQuery call inside this post to manage the functionality of the quiz by playing with the class names of the links:

if( $(this).attr('id') == 'correct') {
return false;

well that's it! but as Julio, fahd and ryan said; this is broad question better if separated to parts because it deals with wordpress + jquery + ajay

hope it helps :)

rhand comments:

Thanks for all the feedback. Will play with all this a bit today or tomorrow. I know it can be quite a bit of work, but I need to make sure it will all fit within the budget. I wonder what a fully working plugin would take. Perhaps four questions of $25, perhaps more...


Julio Potier answers:


Your needs is a specific development/plugin and requires specifications.

I don't think someone can do this in 1 hour.

I suggested a $100 min price.


Fahad Murtaza answers:

I am seconding Julio here.


Ryan Hellyer answers:

This question is way too broad. Perhaps narrow it down to specific questions about parts of the plugin you wish to build rather than a generic question about how to build the whole thing.