Category Archives: CalendarScripts

Memory Section in Watu PRO Questions

A new shortcode in version 6.6.9.5 of Watu PRO allows you to create a memorization section in selected questions. This works by showing the section for a selected period of seconds. After the period is passed, the memory section is shown and the question is revealed.

This can be used to show an image or content that should be memorized and understood before the question.

How It Works

In the questions editor, simply enter the memory section before the question contents, wrapped in a shortcode watupro-memory id=”X” where X is the current question ID.

For example:

watupro-memory shortcode

The shortcode wraps the content that should be in the memory section. Below the closing /watupro-memory shortcode begins the normal question contents.

Parameters

The shortcode accepts the following parameters:

id (required) – This is the current question ID. You can see the ID shown in the poll-like shortcode just above the title field. If you are just creating a question, you will need to save it first and go to edit to get its ID.

seconds (optional) – The number of seconds the memory section is shown before the question contents. Defaults to 5.

Limitations

  • You can have one memory question per quiz page. If you want to add memory sections on different questions, make sure the quiz is paginated.
  • The memory section will reappear if you refresh the page. If you want to use this for an exam, it’s best to combine it with a time limit on the exam. This will discourage quiz takers from refreshing multiple times to see the memory section again, because they will waste their time.

HOCK international: Case Study on the Flexibility and Customizability of Watu PRO

Written By Kevin Hock, CFO of HOCK international

Watu Pro – An Easy Choice

HOCK international prepares candidates for professional accounting exams, and test banks are a critical tool in our study programs. With thousands of multiple-choice questions per exam, we needed a way to categorize, organize, and offer questions by topic to students.

While it can be difficult to evaluate and choose from the dozens of quiz plugins available for WordPress, Watu Pro has been a cornerstone of our learning management system since 2014. In this case study, I will explain how we chose Watu Pro, show some of what is possible using Watu Pro, and give examples of how easily it can be customized.

Powerful and Flexible Test Bank

Watu Pro’s question categories allow us to organize the questions in a way that mirrors the exam structure, and then offer questions to students in various combinations, including by topic, by Section, and from multiple Sections. Furthermore, Watu Pro’s ability to re-use questions from entire quizzes rather than just selecting specific questions is a powerful and unique feature, even among other quiz systems that claim to offer test bank capabilities.

The following screenshot shows how easily a student can pick questions to study from one or many topics (and see their current statistics):

Question Selection

Detailed Statistics

Students preparing for professional certifications want detailed statistics about their performance. Watu Pro’s database tables store every student response in any easy-to-understand layout, which is convenient for creating custom queries to show the students’ progress. Aggregate queries such as SUM, COUNT, and MAX can all be used to create performance metrics. By storing the results of such queries in the WordPress user metadata table, statistics can be displayed in dashboards created through page builders like Beaver Builder, as shown in the following screenshot.

MCQ Stats and charts

HOCK’s Customizations to Watu Pro

Beyond the built-in features, the modular design of Watu Pro allows PHP/MySQL programmers to easily edit the code. With only minimal modifications, we were able to add the following customizations:

  • Show bar graphs of topic-by-topic performance using the wpDataTables plugin.
  • Group incorrect answer choice explanations using expanders.
  • Display explanations for only a limited number of unanswered questions on each quiz.
  • Allow students to delete quizzes with a score under 25%.
  • Show the percent correct next to each topic in the question selection list.
  • Choose questions not yet answered correctly before repeating questions.
  • Sort “All of the above” and “None of the above” to always appear as the last answer choice, even with answer randomization.
  • Create reports for the percent of students who get each question correct on their first try to identify difficult or poorly-worded questions.

Extensive Visual Customization

Watu Pro uses CSS to control many aspects of the quiz layout. In the screenshots below, compare the standard Watu Pro layout to one of the layouts created by Watu’s designer to get an idea for how much the look and feel can be modified.

Default Layout

default design example

Customized Layout

customized design example

The Watu Pro Advantage

Even when HOCK investigated commercial AI-driven learning systems, none of them could match the features offered by Watu Pro. Furthermore, being able to extend the capabilities of Watu Pro offers tremendous advantages over other quiz platforms. With the help of Watu Pro, HOCK has been able to offer a best-in-class learning experience for our students.

About HOCK international

Founded in 2000 by Brian Hock, HOCK international provides complete and affordable study materials for the Certified Management Accountant (CMA) and Certified Internal Auditor (CIA) exams. In addition to the robust test bank powered by Watu Pro, HOCK also offers detailed textbooks, multimedia classroom videos, and the best support and guarantees on the market.

Oddness in The WordPress Posts Loop and WP Query

While working on the new version of Shortcode Revolution we faced a couple of confusing behaviors of WordPress functions. I’ll document them here and will keep adding such information. Hopefully it can help other developers and save them a lot of time and frustration.

Excluding posts from WP Query (using post__not_in)

There is a good comment here explaining that post__not_in wouldn’t work when used with post__in in the same query. This is a good note but our query did not include post__in and post__not_in was still simply ignored. I did not dig deep into the code to see why this happens – the conclusion was simply not to use it.

Here is an example how we get 3 random related posts in Shortcode Revolution:

$query = [];
// we add 1 to the default number of posts which is 3 or to the user-passed number or posts
$query['posts_per_page'] = (empty($atts['num']) or !is_numeric($atts['num'])) ? 4 : intval($atts['num']) + 1;       
$query['orderby'] = 'rand';

// getting the posts here
$wp_query = new WP_Query($query);
$posts = $wp_query->posts;

// now because this is "related posts" query, we don't want the current post to be repeated below it. So let's filter it out
// $post_id is a variable we have defined earlier in the shortcode and it contains the current post ID
// we are using array_filter with a closure here. You can do it inside a loop with a counter but this solution is more elegant
$posts = array_filter($posts, function($p) use($post_id) {				
  return ($p->ID != $post_id);					
});

// if the current post was not there we have one more than needed
if($query['posts_per_page'] < count($posts)) array_pop($posts);

 

So that’s it – you just get more posts than you need and then remove the unwanted ones in PHP.

Showing the excerpt outside of the post loop – get_the_excerpt

If you look at the documentation it sounds like you can call get_the_excerpt with any post ID and receive the excerpt for that post id. Good luck! You may get the proper excerpt (sometimes!) but won’t get the automatically generated “read more” link properly. The first version of our code was this and it did not work:

foreach($posts as $p):
   $background_image =  has_post_thumbnail( $p->ID )  ?  get_the_post_thumbnail_url($p->ID) : ''; 
   $excerpt = get_the_excerpt($p->ID);
.....

I intentionally did not use $posts as $post to avoid overriding the global $post variable but apparently this was wrong. Fortunately this comment gave me the hint how to fix it:

foreach($posts as $p):
   // yes, do override the global!
   $post = $p;
   // and you need to setup_postdata($post)
   setup_postdata($post);
   $background_image =  has_post_thumbnail( $p->ID )  ?  get_the_post_thumbnail_url($p->ID) : ''; 
   $excerpt = get_the_excerpt($p->ID);
......
endforeach;

And after the end of the loop don’t forget to reset the post data:

wp_reset_postdata();